Pickering Drivers in C/C++

The example code described here may be found at: http://downloads.pickeringtest.info/downloads/example_software/C++/

It is necessary to understand the topology of a Pickering card to successfully control a card. See section on topology.

PIPX40 (uses NI VISA)



#include <visa.h>
#include "Pipx40.h"
int _tmain(int argc, _TCHAR* argv[])
    ViSession handle;            // Handles current session and uses it as reference
    ViStatus Status = 0;            // checks Status of a function

Firstly the required header files must be included to provide the function definitions for the driver calls.
In the case of PIPX40, the VISA library must first be included to provide definitions of the data types being used.

    Status = pipx40_init ("PXI7::13::INSTR", 1, 1, &handle);
    if (Status != VI_SUCCESS)

Here a control session is opened on a specific card using the pipx40_init function.
This takes a string as the first parameter that defines the address of the card in VISA resource string format.
The address of the card may be obtained in a number of ways, most commonly by inspecting the list of available devices in NI MAX.

The middle 2 parameters may be ignored for the present.

The last parameter is the address of a variable to hold a unique handle for the card being accessed.
If the function succeeds the return value of the function will be VI_SUCCESS (defined as a value of zero in visa.h).

Should the operation fail for any reason the function return will be non-zero, the value will indicate the nature of the error.

The error value may be queried to obtain a textual explanation of the error.

        pipx40_error_message(handle, Status, msg);
        printf("\nFailed to connect to card because:\n %i ,  %s ",Status, msg);
        return 0;

Once a card is successfully opened there are a number of function calls available to allow the control and monitoring of the switching (or other) functions on the card.

The example code for download uses the pipx40_setChannelPattern function to control switches.

    /// Sets output of this sub-unit to the supplied bit-pattern.
    Status = pipx40_setChannelPattern(handle, subUnit, data);

This function is used to set a group of switches in a single operation. To set a single switch use the pipx40_setChannelState function.

Once the application has finished with the card, the session should be closed.

    if (handle!= 0)
    pipx40_close (handle);

Need Help´╝č


Information on software drivers, product comparisons and technical support for our entire product range.


Product Selector

This tool will help you narrow down our offering to get you the correct switch and simulation solution you need.

Try the selector

Resource center

Success storiesproduct videos and more—find the information you need about our switching and simulation.

Resources you need

Worldwide presence

Find support across the globe, with offices and agents in the Americas, Europe and Asia. 

Find local office or agent