Using Class Drivers in LabWindows/CVI

National Instruments IVI Driver

Using Class Drivers in LabWindows/CVI

You use the IVI class drivers in the LabWindows/CVI the same way that you use other LabWindows/CVI instrument drivers. You can load and unload class drivers manually using the Instrument menu. To load a class driver, complete the following steps:

  1. Select Instrument»Load.
  2. In the Load Instrument dialog box, select the function panel (.fp) file for the class driver you want to load.

The class driver function panel files are in the cvi\instr\iviclass directory.

The following figure shows the Instrument menu after you load the class drivers.

LabWindows/CVI Instrument Menu

You do not have to include the class drivers that you load through the Instrument menu in your project, and you can load and unload them at any time. Class drivers that are loaded through the Instrument menu are not automatically loaded to your project and can be unloaded at any time. However, you must reload the driver every time you launch LabWindows/CVI.

To add the IVI class drivers into your project, complete one of the following steps:

  1. Open the Function Panel window.
  2. Select File»Add to Project.

or

  1. From the Project window, select Edit»Add to Project»Instrument (.fp).
  2. Choose the .fp file for the driver.

The .fp file represents the class driver in the project list. If the .fp file is in the project list, LabWindows/CVI automatically loads the class driver when you open the project and removes the class driver when you unload the project.

A class driver function panel contains a function panel window for each function that the class driver exports. With the function panel windows, you can interactively call class driver functions and automatically generate code for your application.

The class drivers have high-level and low-level functions. With the high-level functions, you can easily initialize and close the instrument, configure the instrument, control instrument operations, and retrieve measurements. High-level functions set multiple instrument attributes in a single operation.

For example, to set up and take a measurement using a DMM, you might use the following high-level statements in your program:

ViReal64 reading;
ViSession dmmHandle;
IviDmm_Init ("DMM1", VI_TRUE, VI_TRUE, &dmmHandle);
IviDmm_ConfigureMeasurement (dmmHandle, IVIDMM_VAL_DC_VOLTS_RATIO, IVIDMM_VAL_AUTO_RANGE_ON, 0.0006));
IviDmm_ConfigureTrigger (dmmHandle, IVIDMM_VAL_IMMEDIATE, 0.0));
IviDmm_Read (dmmHandle, 5000, &reading));
IviDmm_close (dmmHandle);

With the low-level functions of the class drivers, you can access individual instrument driver attributes. For example, the following figure shows the Set Attribute function panel for the IviDmm class driver. Refer to the IVI Class Driver Help for LabWindows/CVI for more information on how to use function panels in LabWindows/CVI.