Using the GXCAL Driver Functions

The GXCAL driver contains a set of functions for the GX1034. Functions names that starts with the GxCal prefix applies to all GXCAL boards (i.e. GxCalGetDriverSummary). The GXCAL functions are designed with consistent set of arguments and functionality. All boards have a function that initializes the GXCAL driver for a specific board, reset the board, and display the virtual panel. All the functions use handles to identify and reference a specific board and all functions return status and share the same functions to handle error codes.

Initialization, HW Slot Numbers and VISA Resource 

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

1.      Marvin Test Solutions’ HW - the default device driver that is installed by the GXCAL driver. To initialize and control the board using the HW use the GxCalInitialize(nSlot, pnHandle, pnStatus) function. The function initializes the driver for the board at the specified PXI slot number (nSlot) and returns a board 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

2.      VISA – this is a third party library usually by National Instruments (NI-VISA). You must ensure that the VISA installed supports PXI and PCI devices (not all VISA providers supports PXI/PCI). GXCAL setup installs a VISA compatible driver for the GXCAL board in-order to be recognized by the VISA provider. Use the GXCAL function GxCalInitializeVisa (szVisaResource, pnHandle, pnStatus) to initialize the driver 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:

Information about VISA is available at http://www.pxisa.org.

The GxCalInitialize function returns a handle that is required with other driver functions to program the board. This handle is usually saved in the program in a global variable for later use when calling other functions. The initialize function does not change the state of the board or its settings.

Board Handle

The board handle argument, nHandle , passed (by reference) to the parameter pnHandle of the GxCalInitialize or the GxCalInitializeVisa functions is a short integer (16 bits) number. It is used by the GXCAL driver functions to identify the board being accessed by the application. Since the driver supports many boards at the same time, the nHandle argument is required to uniquely identify which board is being programmed.

The nHandle is created when the application calls the GxCalInitialize function. But there is no need to destroy the handle. Calling GxCalInitialize with the same slot number will return the same handle.

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

Reset

The Reset function causes the driver to change all settings to their default state. The application software issues a Reset after the initializing the Counter, but a Reset can be issued any time. All counter boards have the GxCalReset(nHandle, nStatus) function. See the Function Reference for more information regarding the specific board.

Error Handling

All GXCAL functions pass a fail or success status - pnStatus - in the last parameter. A successful function call passes zero in the status parameter upon return. If the status is non-zero, then the function call fails. This parameter can be later used for error handling. When the status is error, the program can call the GxCalGetErrorString function to return a string representing the error. The GxCalGetErrorString reference contains possible error numbers and their associated error strings.

Driver Version

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