Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
LabVIEW-Measurements.pdf
Скачиваний:
61
Добавлен:
29.05.2015
Размер:
3.37 Mб
Скачать

Chapter 19 Instrument Drivers in LabVIEW

Organization of Instrument Drivers

Figure 19-1 shows the organization of a typical instrument driver. This model applies to numerous instrument drivers.

Instrument Driver Model

Application Programs

 

Getting Started VI

 

 

 

 

 

 

 

 

 

 

Functional Body

Application VIs

Initialize

 

 

 

 

 

 

 

Close

 

Configure

 

Action &

 

Data

 

Utility

 

 

 

Status

 

 

 

 

 

 

 

 

 

 

 

Component VIs

 

 

 

 

 

Support VIs

 

VISA

 

 

 

 

 

Figure 19-1. Instrument Driver Model

The Getting Started VIs are simple application VIs you can use without modification. Run this VI to verify communication with your instrument. Typically you only need to change the instrument address before running the VI from the front panel. However, many also require you to specify the VISA Resource name, for example, GPIB::2. Refer to Chapter 20, VISA in LabVIEW, for more information about VISA Resource names.

The Getting Started VI generally consists of three sub-VIs: the

Initialize VI, the Application VI, and the Close VI.

The Application VIs are high-level examples of grouping together low-level component functions to execute a typical programmatic instrument operation. For example, the Application VIs might include VIs to control the most commonly used instrument configurations and measurements. These VIs serve as a code example to execute a common operation such as configuring the instrument, triggering, and taking a measurement.

Because the application VIs are standard VIs with icons and connector panes, you can call them from any high-level application when you want a single, measurement-oriented interface to the driver. For many users, the

LabVIEW Measurements Manual

19-2

www.ni.com

Chapter 19 Instrument Drivers in LabVIEW

application VIs are the only instrument driver VIs needed for instrument control. The HP34401A Example VI, shown in Figure 19-2, demonstrates an application VI front panel and block diagram.

Figure 19-2. HP34401A Example

The Initialize VI, the first instrument driver VI called, establishes communication with the instrument. Additionally, it can perform any necessary actions to place the instrument either in its default power on state or in some other specific state. Generally, the Initialize VI only needs to be called once at the beginning of your application program.

© National Instruments Corporation

19-3

LabVIEW Measurements Manual

Chapter 19 Instrument Drivers in LabVIEW

The Configuration VIs are a collection of software routines that configure the instrument to perform the desired operation. There may be numerous Configuration VIs, depending on the particular instrument. After these VIs are called, the instrument is ready to take measurements or stimulate a system.

The action/status category contains two types of VIs. Action VIs initiate or terminate test and measurement operations. These operations can include arming the trigger system or generating a stimulus. These VIs are different from the Configuration VIs because they do not change the instrument settings, but only 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 from a measurement instrument 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, and might 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 up system resources. Generally, the Close VI only needs to be called once at the end of your application program or when you finish communication with your instrument. Make sure that for each successful call to the Initialize VI you have a matching Close VI. Otherwise you maintain unnecessary memory resources.

Note Application functions do not call Initialize and Close. To run an application function, you first must run the Initialize VI. The Getting Started VI calls Initialize and Close.

Kinds of Instrument Drivers

There are different kinds of instrument drivers. The difference is not as much in how you use them as in how they are implemented. The three kinds are usually called:

LabVIEW instrument drivers

VXIplug&play instrument drivers

IVI drivers

LabVIEW Measurements Manual

19-4

www.ni.com

Chapter 19 Instrument Drivers in LabVIEW

The order here represents the evolution of instrument driver standards over the last several years, though all three kinds of drivers are viable and available today.

LabVIEW drivers are so called because they are written entirely with LabVIEW functions. The other two kinds are almost always written in C and have VI “wrappers” around each C function call. LabVIEW instrument drivers are easier to modify and debug than the other kinds of drivers, and they are easily converted from one computer hardware platform to another. However, many of these drivers are older and do not conform to any standard interface. For example, the functions you find in a driver for one brand of multimeter may be completely different from those found in a driver for a different multimeter.

The LabVIEW instrument driver library contains instrument drivers for a variety of programmable instruments that use GPIB, VXI or serial interfaces. You can use a library driver for your instrument as is. However, LabVIEW instrument drivers are distributed with their block diagram source code, so you can customize them for your specific application if need be.

The VXIplug&play consortium attempted to improve this situation by standardizing on VISA as the communications interface, as well as other details, such as where drivers would be installed. While the VXIplug&play standards admit drivers written entirely in LabVIEW, almost all VXIplug&play drivers are written in C and then converted for use in LabVIEW. To modify such a driver, you have to use a C-based development environment, such as LabWindows/CVI, and then convert the driver to LabVIEW again. The drivers also must be recompiled if you want to use them on another computer hardware platform. Refer to www.vxipnp.org for more information about the VXIplug&play consortium.

While the VXIplug&play standards did bring some consistency to instrument drivers, they did not address certain applications, such as production testing. The IVI Foundation was formed to bring even more standardization to instrument drivers. This time, instrument-specific programming interfaces were explicitly defined for the C language. This means that you can write a program that can work with any of several different brands of oscilloscope without needing special code for each model in your application. To change from one model to another just requires a change to configuration. The IVI Foundation also addressed other issues, such as simulation of missing instruments and performance. Refer to www.ivifoundation.org for more information about the IVI Foundation.

© National Instruments Corporation

19-5

LabVIEW Measurements Manual

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]