How to Use an Instrument Driver in LabVIEW Tutorial

Publish Date: Oct 16, 2019 | 46 Ratings | 3.20 out of 5 | Print | 3 Customer Reviews | Submit your review

Table of Contents

  1. Overview of Instrument Drivers
  2. Using an Instrument Driver in LabVIEW
  3. Related Links

1. Overview of Instrument Drivers

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.

National Instruments provides instrument drivers for a wide variety of instruments; these instrument drivers are written in LabVIEW and/or LabWindows/CVI and use either the Virtual Instrumentation Software Architecture (VISA) or the Interchangeable Virtual Instrument (IVI) protocol.


Back to Top

2. Using an Instrument Driver in LabVIEW

In LabVIEW, an instrument driver is a set of VIs that communicates with an instrument. Each VI corresponds to a programmatic operation, such as configuring, reading from, writing to, and triggering an instrument. LabVIEW instrument drivers simplify instrument control and reduce test program development time by eliminating the need for you to learn the complex, low-level programming commands for each instrument.

Where to Find Instrument Drivers and How to Download Them

You can find and download instrument drivers using the NI Instrument Driver Finder or the Instrument Driver Network (IDNet).

Use the NI Instrument Driver Finder to find, download, install, and access LabVIEW Plug and Play drivers for an instrument. Select Tools»Instrumentation»Find Instrument Drivers to launch the Instrument Driver Finder. This tool searches IDNet to find the specified instrument driver. Refer to the figure below to see how to launch the NI Instrument Driver Finder from LabVIEW.

Figure 1. Launching the NI Instrument Driver Finder


LabVIEW Instrument Driver VIs and Examples

In LabVIEW 2010 and later, after the instrument driver installs, you can use the Instrument Driver Finder to access the instrument driver VIs. You also can use the Instrument Driver Finder to open example programs covering everything from analysis and presentation to using your instrument driver. 


Figure 2. NI Instrument Driver Finder in LabVIEW 2017

Once a driver has been installed, you can access the instrument driver from the Instrument I/O palette. For example, open the Agilent 34401 instrument driver that ships with LabVIEW from the Instrument I/O>>Instrument Drivers>>Agilent 34401 palette. The following figure shows this palette and some of the VIs and subpalettes that are shipped with it.

Figure 3. Agilent 34401 Palette


Many instrument drivers have a VI Tree VI you can use to view the entire instrument driver hierarchy. The VI Tree VI is a nonexecutable VI that illustrates the functional structure of the instrument driver.

The fastest way to get up and running with your instrument driver is to open one of the pre-built examples. For project-style instrument drivers, you can find these in the example finder under Hardware Input and Output>>Instrument Drivers>>LabVIEW Plug and Play. For other instrument driver types, the examples will be available from the Application Examples subpalette from the corresponding instrument driver. In the following figure we have opened the Agilent 34401 Read Multiple example that comes with the Agilent 34401 instrument driver. This example shows how to configure a measurement and take multiple readings.

Figure 4. Agilent 34401 Read Multiple Measurements Front Panel

In this example, serial communication is used. On the front panel, there are controls for the VISA resource name, the Serial Configuration, the type of Function, the Sample Count, and the Timeout. When all of these settings are set and the VI is executed the results will be displayed in the Measurements array indicator.

Figure 5. Agilent 34401 Read Multiple Measurements Block Diagram

From the block diagram you can see that the instrument is first initialized with the Serial Configuration and VISA resource name specified on the front panel. Then the Configure Measurement VI is called to set the instrument up for the desired measurement. The Configure Autozero VI is also used which configures the instrument’s autozero setting. Enabling autozero optimizes the instrument for accuracy, while disabling optimizes for speed. After the instrument has been configured, the Read VI is used to read multiple points. Once the measurement is complete, the Close VI is called which performs an instrument error query and terminates the software connection to the instrument. Finally, the Simple Error Handler is called which indicates whether an error occurred.


Instrument Driver Organization

Once an instrument driver has been downloaded, the instrument driver VIs will be located on the Instrument Drivers palette. Most instrument drivers have menu palettes that include the following components.

  • The Initialize VI- the first instrument driver VI you call, establishes communication with the instrument. Additionally, it can perform any necessary actions to place the instrument in its default power on state or in another specific state. Generally, you need to call the Initialize VI only once at the beginning of an application.
  • The Configuration VIs- a collection of software routines that configure the instrument to perform the operation you want. Numerous Configuration VIs can exist, depending on the particular instrument. After you call these VIs, the instrument is ready to take measurements or to stimulate a system.
  • The Action VIs - initiate or terminate test and measurement operations, such as arming the trigger system or generating a stimulus. Action VIs are different from Configuration VIs because they 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.
  • The 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.
  • The Utility VIs- perform a variety of operations that are auxiliary to the most often used instrument driver VIs. These VIs include the majority of the instrument driver template VIs, such as reset, self-test, revision, error query, and error message. The Utility VIs might also include other custom instrument driver VIs that perform operations such as calibration or storage and recall of setups.
  • The Close VI- terminates the software connection to the instrument and frees system resources. Generally, you need to call the Close VI only once at the end of an application or when you finish communication with an instrument. Make sure that for each successful call to the Initialize VI, you use a matching Close VI to avoid maintaining unnecessary memory resources.

You can use an instrument driver for a particular instrument as is. However, LabVIEW Plug and Play instrument drivers are distributed with their block diagram source code, so you can customize them for a specific application. You can create instrument control applications and systems by programmatically linking instrument driver VIs on the block diagram.


Back to Top

3. Related Links

Back to Top

Customer Reviews
3 Reviews | Submit your review

modify example vi's for other use  - Feb 25, 2013

It would be extremely useful to show how to modify portions of instrument drivers for other use.

  - Apr 3, 2012

Good summary

  - Apr 4, 2011

Good Info

Bookmark & Share


Rate this document

Answered Your Question?
Yes No