Using Plug-and-Play Instrument Drivers in LabVIEW

Updated Jun 3, 2024

Environment

Software

  • LabVIEW

Driver

  • NI-VISA

This tutorial shows you how to find, install, and use a plug-and-play instrument driver in LabVIEW.

An instrument driver is a set of software routines that control a programmable instrument. Each routine corresponds to a programmatic operation such as configuring, reading from, writing to, and triggering the instrument. Instrument drivers simplify instrument control and reduce test program development time by eliminating the need to learn the programming protocol for each instrument.

Prerequisites

Find and Install Instrument Driver

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

NI Instrument Driver Finder

  1. Launch LabVIEW.
  2. Open NI Instrument Driver Finder by navigating to the Tools tab >> Instrumentation >> Find Instrument Drivers.
  3. If you have a connected and powered on instrument, double-click the instrument under Connected Instruments to populate the Manufacturer and Additional Keywords search fields. If your instrument is physically connected but not listed, click Scan for Instruments to detect any instruments.

If you do not have a connected instrument, manually select from the Manufacturer field. You can type the model of your instrument in the Additional Keywords field or leave it blank to display all drivers from a specific manufacturer.
 


 

  1. Click Search. A list of instrument drivers from the chosen manufacturer and their descriptions are displayed.

  1. Once you find the driver for your instrument, click Install. If you cannot find a driver for your instrument, skip to the Instrument Driver Network (IDNet) section below for how to search for it in IDNet.
  2. A dialog box will appear notifying you the installation was successful and the location of the driver. The instrument driver should be installed in <National Instruments>\LabVIEW<xxxx>\instr.lib for Plug and Play drivers.
     

 

  1. Make sure the instrument driver installed properly by checking if it appears in the LabVIEW palette. Right-click on the block diagram >> Instrument I/O >> Instrument Drivers. If you don’t see the instrument driver palette, refer to Third Party Instrument Driver Missing in LabVIEW After Installation.


Instrument Driver Network (IDNet)

If you are unable to find an instrument driver using the NI Instrument Driver Finder, you can search in the online Instrument Driver Network (IDNet). IDNet has a more extensive library, but an additional step is required to properly install the instrument driver.

  1. Navigate to the Instrument Driver Network (IDNet).
  2. 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 Next Steps section below.
  3. 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. Extract the contents of the .zip file to the subdirectory <National Instruments>\LabVIEW<xxxx>\instr.lib.
  4. If you have LabVIEW open, close and restart it.
  5. Make sure the instrument driver installed properly by checking if it appears in the LabVIEW palette. Right-click on the block diagram >> Instrument I/O >> Instrument Drivers. If you don’t see the instrument driver palette, refer to Third Party Instrument Driver Missing in LabVIEW After Installation.

Run a LabVIEW 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.

  1. To locate an example, navigate to the Help tab in LabVIEW >> Find Examples…>> Hardware Input and Output >> Instrument Drivers >> LabVIEW Plug and Play.
  2. Select an example to use with your instrument.
  3. Ensure the proper VISA resource name is selected and other settings are correct before running the example. If you experience issues, refer to Troubleshooting NI-VISA, 488.2, Serial, and Modular Instrument Drivers.

To better use the examples, it is helpful to understand the main components of an instrument driver menu palette. 

Note: You can enable LabVIEW Context Help for VI function descriptions of the VI by selecting Ctrl+H.

Component

Description

Initialize VI

  • Establishes communication with the instrument.

  • Can perform any necessary actions to place the instrument in its default power-on state or in another specific state.

  • Generally, only needs to be called once at the beginning of an application.

Configuration VIs

  • Configures the instrument to perform the desired operation.

  • Numerous configuration VIs can exist depending on the instrument.

  • Instrument is ready to take measurements or to stimulate a system after these VIs are called.

Action VIs

  • Initiate or terminate test and measurement operations, such as arming the trigger system or generating a stimulus.

  • Differ from Configuration VIs in that Action VIs do not change the instrument settings but order the instrument to carry out an action based on its current configuration.

  • The Status VIs obtain the current status of the instrument or the status of pending operations.

Data VIs

  • Transfer data to or from the instrument.

  • Examples include VIs for reading a measured value or waveform and VIs for downloading waveforms or digital patterns to a source instrument.

Utility VIs

  • Perform a variety of operations that are auxiliary to the most often used instrument driver VIs.

  • Include the majority of the instrument driver template VIs, such as reset, self-Test, revision, error query, and error message.

  • Can include other custom instrument driver VIs that perform operations such as calibration or storage and recall of setups.

Close VI

  • Terminates the software connection to the instrument and frees system resources.

  • Generally, only needs to be called once at the end of an application or when communication is finished with the instrument.

  • Make sure that for each successful call to the Initialize VI, a matching Close VI is used to avoid maintaining unnecessary memory resources.

Next Steps

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

If using a Plug and Play instrument 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 LabVIEW for more options.