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.
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 two different ways. If you are using LabVIEW 8.0 or later, the easiest way is to use the NI Instrument Driver Finder. If you have an older version of LabVIEW, then you can use 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
The alternative to using the NI Instrument Driver Finder is to go directly to the Instrument Driver Network and search for your instrument driver there. You can find drivers for over 6000 instruments on this site. For more information, visit the Instrument Driver Network.
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 2010
In all versions of LabVIEW, you also can use the NI Example Finder to search or browse for project-style instrument driver examples. You can find non-project style instrument driver examples in the Instrument Drivers palette and subpalettes.
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 Measurements.vi 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 Configuration VIs are 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.
The following figure shows the organization of a typical instrument driver.
Figure 6. Instrument Driver Organization
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.
3. Related Links
How to Use and Instrument Driver in LabWindow/CVI Tutorial
Instrument Driver Network
New Tools for Instrument Driver Development with LabVIEW 8
Developing LabVIEW Plug and Play Instrument Drivers
LabVIEW Tips and Tricks for Quickly Creating Better Instrument Drivers
What is an Instrument Driver?
Using IVI Drivers in LabVIEW
On-Demand Training: IVI Fundamentals I - What Are IVI Drivers? (SSP required)
On-Demand Training: IVI Fundamentals II - Why Use IVI Drivers? (SSP required)