Using IVI Drivers in LabVIEW or LabWindows™/CVI

Updated Dec 11, 2023

Environment

Software

  • LabVIEW
  • LabWindows/CVI

Driver

  • IVI Compliance Package

This tutorial shows you how to find, install, and use an interchangeable virtual instrument (IVI-C) driver in LabVIEW or LabWindows/CVI. For more information about IVI drivers, refer to the IVI Foundation or the NI resources below.

After completing this tutorial, you should be able to:
  • Use NI Measurement & Automation Explorer (MAX) to configure your instrument system.
  • Run an example application that makes calls to an IVI class driver.
  • Swap out instruments without recompiling or relinking the application source code.
Note: This tutorial uses a HP 34401A and Fluke Fl45 DMM as examples. However, physical instruments are not required for this tutorial as you can run IVI drivers in simulation mode.

Install NI Software and Drivers

Install the latest compatible version of the NI-VISA  driver and IVI Compliance Package. Check the Readme for system and software compatibility or refer to the following for compatibility information.


Find and Install Instrument Driver

Use the NI Instrument Driver Network to find and install the instrument driver.

  1. Navigate to the Instrument Driver Network (IDNet).
  2. To narrow your search to just IVI drivers, expand the Technology filter on the search page and click on IVI.
  3. Enter the instrument manufacturer and model into the search field and click Search. If you cannot find the driver for your instrument, skip to the Other steps section.
  4. Click the model name in the search results to display the list of available drivers. The instrument model page will display the available driver types and supported Application Development Environments (ADE) for the instrument.
  1. Select your driver by clicking Go to Driver Page.
  2. Download the driver for your ADE version by clicking Download Driver Now.
  3. Run the self-extracting executable.
  4. Follow the installer prompts to install the driver. Select Finish when the installation completes.
  5. Restart the computer after installing the driver.
  6. Confirm the installation was successful.
  • The contents of the .zip file is installed to subdirectory <National Instruments>\LabVIEW<xxxx>\instr.lib/<driver name>.
  • The driver installer automatically creates a driver session entry under the Driver Sessions tab in NI MAX and populates the software module information under the Instrument Driver Software Modules item in the Advanced tab in NI MAX.

For the purpose of demonstrating instrument interchangeability later in this tutorial, find and install two IVI-C specific drivers that are from the same class. The IVI class is indicated by the IVI Class Specification and Version on the instrument driver page. This tutorial uses the HP 34401A and Fluke fl45 DMM instrument drivers as examples.

 

Configure IVI System in NI MAX

Complete the following steps to configure your IVI system in NI Measurement and Automation Explorer (MAX).

Create and Configure a Logical Name

Logical names allow you to define and name multiple driver sessions. You can switch between driver sessions by passing a logical name to the initialize function of a class driver, which identifies the software module and hardware asset to use. Application programs written using a class driver use logical names to avoid direct references to software modules and hardware assets.

  1. Launch NI MAX from the Start Menu.
  2. Expand IVI Drivers. If you do not see the IVI Drivers folder, refresh NI MAX.
  3. Right-click Logical Names and select Create New (case sensitive).
  4. Replace the default logical name, NewLogicalName, with the new case-sensitive name of your choice, such as MyDmm.
  1. To configure the properties of the logical name, navigate to the General tab of the logical name. Select the driver session from the Driver Session drop down list and enter a description in the Description field. For this tutorial, select hp34401a as the driver session.

  1. Click Go To to view and configure the properties of the driver session.
 

Configure a Driver Session

A driver session defines a set of properties for use by IVI drivers, such as initial settings for attributes, virtual name mappings, simulation settings, and more.

  1. Selecting Go To from the previous section will expand the driver sessions of the instrument.
  2. In the General tab, configure the following:
  1. Enable or disable the appropriate initialization options.
  2. Select the appropriate Simulate With option.
  • If the instrument is physically connected, select Don't Simulate.
  • If the instrument is not physically connected or available, select Specific Driver.

Note: If you choose to simulate with a specific driver, the specific driver functions return random simulated values for output parameters that represent instrument data. If you choose to simulate with a class simulation driver, select the simulation driver that matches the class of your specific driver. The simulation driver extends the simulation capabilities built into all specific drivers and allows you to configure the nature of the simulated instrument data interactively. The simulation drivers appear in this list only if they are installed with the IVI Compliance Package.

  1. If you selected Don’t Simulate from the previous step, navigate to the Hardware tab to add a new hardware asset.
  1. Click Add to create the hardware asset.
  2. Enter the name and press Enter.
  3. Double-click in the Resource Descriptor field. Select a resource from the drop-down list or manually enter the resource descriptor information for the new hardware asset.
  4. Enter a description for the new hardware asset in Description.
  5. Make sure to "check" the checkbox of the hardware asset to select it.
  1. In the Software tab, select a software module if one is not already selected.
  2. In the Virtual Names tab, modify the existing virtual names or create new ones.
  1. Click Add.
  2. In Virtual Name, enter the new virtual name you want to create.
  3. In Physical Name, select a mapping from the drop-down list or enter a new mapping directly into Physical Name.
  1. In the Initial Settings tab, you might see one of the following conditions:
  • If the Configurable Settings field is enabled, you can add settings to or remove settings from the Initial Settings list. To add settings, highlight a setting in the Configurable Settings list and click Add. To remove settings, highlight a setting in the Initial Settings list and click Remove.
  • If the Configurable Settings field is disabled (grayed out), you can only remove settings from the Initial Settings list. To remove settings, highlight a setting in the Initial Settings list and click Remove.

Note: If the driver does not define configurable initial settings, these lists will be empty.

  1. Click Save IVI Configuration at the top of the configuration view.
  2. Exit NI MAX.


Run an Example

After configuring the IVI driver, you are ready to run an example. The instrument driver will install examples and the API required to communicate with your instrument. Use these examples as programming references and an easy way to start using your instrument.

LabVIEW

  1. Launch LabVIEW. Navigate to the Help tab>> Find Examples…>> Hardware Input and Output >> Instrument Drivers >> IVI >> Class.
  2. Select an example to use with your instrument. For this tutorial, you can select IviDMM-Single Point Measurement.vi.
  3. Select the proper IVI Logical Name resource and make sure the configuration settings are correct. Run the example.

 
  1. Change the configuration settings on the front panel and rerun the example.

Note: If you receive an error message after you change the configuration, the configuration settings may not match those of the instrument.

  1. Leave the example open and continue to the Interchange Instruments section.

 

LabWindows/CVI

  1. Launch LabWindows/CVI. Select Find Examples… from the Welcome page.
  2. On the Browse tab of NI Example Finder, navigate to Hardware Input and Output >> Instrument Drivers >> IVI >> Class.
  3. Select an example to use with your instrument. For this tutorial, you can select ividmm.proj.
  4. Select Run>> Debug <example name>_dbg.exe.
  5. In the Initialize DMM panel, type the logical name you want to use in the Logical Name field. For this tutorial, you can input MyDmm. Click Initialize.
  1. In the Configure DMM Panel, make sure the configuration settings are correct and click Configure.

 
  1. In the Read DMM Panel, click Read. To take multiple readings, click Read repeatedly.
 

 
  1. To change the configuration settings of the DMM, return to the Configure DMM Panel by clicking Configure.

To view the IVI class driver calls made in this example, select File>>Open>>Source (*.c) to open the source code of the example.

 

Interchange Instruments

To interchange instruments, update the driver session in NI MAX.

  1. Launch NI MAX. Expand IVI Drivers in the configuration tree.
  2. Expand Logical Names and select the appropriate logical name from the list.
  3. On the configuration panel, select the different driver session that your logical name should refer to from Driver Sessions. For this tutorial, select fl45.

Note: You must install the IVI-C specific driver to see its driver session in the drop-down list.


 
  1. If simulating, select Go To and navigate to the General tab of the fl45 driver session. Make sure you select Specific Driver from Simulate With.
  2. Click Save IVI Configuration.
  3. Exit MAX. You are now ready to run the example program using the same logical name but a different instrument.
  4. To verify instrument interchange, repeat the steps in Run an Example section.

Next Steps

If you are unable to find an instrument driver using the Instrument Driver Network, contact the manufacturer of your instrument directly. In some cases, instrument manufacturers make drivers available on their websites. 

If using an IVI driver doesn’t fit your application needs, or you want to modify or create your own instrument driver, refer to Choosing the Right Interface to Control Instruments in LabWindows/CVI  for more options.