Using the GXPIO Driver Functions

The GXPIO driver contains a set of functions for each of the supported instrument boards. The function name also starts with the board type. For example the GX5641 board uses the Gx6541Xxxx functions. Other functions are available as general purpose functions that apply to all boards (i.e GxPioGetDriverSummary).

Each of the board types has similar functions that initialize the board driver, reset the board, and display the instrument virtual panel. In addition, all the board types use handles (see below) to access the boards and use the same error handling method. The following paragraphs describe the steps required to program the boards.

Initialization, HW Slot Numbers and VISA Resource  

The GXPIO driver supports two device drivers HW and VISA which are used to initialize, identify and control the board. The user can use the Gx5641Initialize to initialize the board‘s driver using HW and Gx5641InitializeVisa to initialize using VISA. The following describes the two different methods used to initialize:

  1. Marvin Test Solutions' HW – This is the default device driver that is installed by the GXPIO driver. To initialize and control the board using the HW use the GX5641Initialize (nSlot, pnHandle, pnStatus) function. The function initializes the driver for the board at the specified PXI slot number (nSlot) and returns boards handle. The PXI/PCI Explorer applet in the Windows Control Panel displays the PXI slot assignments. You can specify the nSlot parameter  in the following way:

 

 PXI/PCI Explorer

  1. VISA – This is a third party library usually supplied by National Instruments (NI-VISA). You must ensure that the VISA installed supports PXI and PCI devices (not all VISA providers supports PXI/PCI). GXPIO setup installs a VISA compatible driver for the GXPIO board in-order to be recognized by the VISA provider. Use the GXPIO function GX5641InitializeVisa (szVisaResource, pnHandle, pnStatus) to initialize the driver’s board using VISA. The first argument szVisaResource is a string that is displayed by the VISA resource manager such as NI Measurement and Automation (NI_MAX). It is also displayed by Marvin Test Solutions PXI/PCI Explorer as shown in the prior figure. The VISA resource string can be specified in several ways as the following examples demonstrate:

Information about VISA is available at 189H189Hhttp://www.ivifoundation.org.

Board Handle

The Gx5641Initialize and the Gx5641InitializeVisa functions return a handle that is required by other driver functions in order to program the board. This handle is usually saved in the program as a global variable for later use when calling other functions. The initialize functions do not change the state of the board or its settings.

Once the board is initialized the handle can be used with other functions calls to program the board.

Reset

The Reset function sets the board to a known default state. A reset is usually performed after the board is initialized. See the Function Reference for more information regarding the reset function.

Error Handling

All the GXPIO functions returns status - pnStatus - in the last parameter. This parameter can be later used for error handling. The status is zero for success status or less than zero for errors. When the status is error, the program can call the GxPioGetErrorString function to return a string representing the error. The GxPioGetErrorString reference contains possible error numbers and their associated error strings.

Driver Version

The GxPioGetDriverSummary function can be used to return the current GXPIO driver version. It can be used to differentiate between the driver versions. See the Function Reference for more information.

Panel

Calling the Gx5641Panel will display the instrument front panel in a window. The panel can be used to initialize and to control the board interactively. The panel function may be used by the application to allow the user to directly interact with the board.

The Gx5641Panel function is also used by the GXPIOPANEL.EXE or GXPIOPANEL64.EXE   panel programs that is supplied with this package and provides a standalone Windows application that displays the instrument panel.