Upload
karuna-avatara-dasa
View
221
Download
0
Embed Size (px)
Citation preview
8/13/2019 NI Tutorial 2804 En
http://slidepdf.com/reader/full/ni-tutorial-2804-en 1/41/4 www.ni.c
1.
2.
3.
How to Use an Instrument Driver in LabVIEW Tutorial
Publish Date: Apr 11, 2012 | 30 Ratings | out of 53.20
Table of Contents
Overview of Instrument Drivers
Using an Instrument Driver in LabVIEW
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 and/orLabVIEW 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 triggeri
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 . If you have an older version oNI Instrument Driver Finder
LabVIEW, then you can use the (IDNet).Instrument Driver Network
Use the to find, download, install, and access LabVIEW Plug and Play drivers for an instrument. Select to launchNI Instrument Driver Finder Tools»Instrumentation»Find Instrument Drivers
Instrument Driver Finder. This tool searches IDNet to find the specified instrument driver. Refer to the figure below to see how to launch the from LabVIEW.NI Instrument Driver Finder
Figure 1. Launching the NI Instrument Driver Finder
The alternative to using the is to go directly to the and search for your instrument driver there. You can find drivers for over 6000 instrumeNI Instrument Driver Finder Instrument Driver Network
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.
8/13/2019 NI Tutorial 2804 En
http://slidepdf.com/reader/full/ni-tutorial-2804-en 2/42/4 www.ni.c
Figure 2. NI Instrument Driver Finder in LabVIEW 2010
In all versions of LabVIEW, you also can use the to search or browse for project-style instrument driver examples. You can find non-project style instrument driver examples inNI Example Finder
palette and subpalettes.Instrument Drivers
Once a driver has been installed, you can access the instrument driver from the palette. For example, open the Agilent 34401 instrument driver that ships with LabVIEW from theInstrument I/O
palette. The following figure shows this palette and some of the VIs and subpalettes that are shipped with it.Instrument I/O>>Instrument Drivers>>Agilent 34401
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
. For other instrument driver types, the examples will be available from the subpalette fromHardware Input and Output>>Instrument Drivers>>LabVIEW Plug and Play Application Examples
corresponding instrument driver. In the following figure we have opened the example that comes with the Agilent 34401 instrument driver. ThisAgilent 34401 Read Multiple Measurements.vi
example shows how to configure a measurement and take multiple readings.
8/13/2019 NI Tutorial 2804 En
http://slidepdf.com/reader/full/ni-tutorial-2804-en 3/43/4 www.ni.c
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 Timeou
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 instrumen
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 palette. Most instrument drivers have menu palettes that include the followinInstrument Driverscomponents.
- , 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 poweThe Initialize VI
on state or in another specific state. Generally, you need to call the Initialize VI only once at the beginning of an application.
- 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 The Configuration VIs
instrument. After you call these VIs, the instrument is ready to take measurements or to stimulate a system.
- 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 doThe Action VIs
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.
- 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 instrumeThe Data 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,The Utility VIs
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.
- 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 finishThe Close VI
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
hem for a specific application. You can create instrument control applications and systems by programmatically linking instrument driver VIs on the block diagram.
8/13/2019 NI Tutorial 2804 En
http://slidepdf.com/reader/full/ni-tutorial-2804-en 4/44/4 www.ni.c
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)