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

Chapter 19 Instrument Drivers in LabVIEW

Error In/Error Out Clusters

Error handling with instrument driver VIs is similar to error handling with other I/O VIs in LabVIEW. Each instrument driver VI contains Error In and Error Out terminals for passing error clusters from one VI to another. The error cluster contains a Boolean flag indicating whether an error has occurred, a number for the error code, and a string containing the location of the VI where the error occurred.

Each instrument driver VI is written so that when an error occurs previously (passed to the Error In terminal), the VI does not run. The error information is passed to the next VI through the Error Out terminal. You can find the Simple Error Handler VI on the Functions»Time & Dialog palette. This VI displays a dialog box if an error occurs and also looks up the error code to determine possible reasons for the error. You can use this VI at any time in your application to display any possible error conditions.

Verifying Communication with Your Instrument

Running the Getting Started VI Interactively

To verify communication with your instrument and test a typical programmatic instrument operation, first open the Getting Started VI. Look over each of the controls and set them appropriately. Generally, with the exception of the address field, the defaults for most controls are sufficient for your first run. You will need to set the address appropriately. On Windows, you can refer to Measurement & Automation Explorer for help if you do not know the address of your instrument. After running the VI, check to see that reasonable data was returned and an error was not reported in the error cluster. The most common reasons for the Getting Started VI to fail include the following:

NI-VISA is not installed. If you did not choose this as an option during your LabVIEW installation, you must install it before running your Getting Started VI.

The instrument address was incorrect. The Getting Started VI requires you to specify the correct address for your instrument. If you are not certain of your instrument address, use Measurement & Automation Explorer or the Find Resource function.

The instrument driver does not support the exact model of instrument you are using. Double-check that the instrument driver supports the instrument model you are using.

© National Instruments Corporation

19-7

LabVIEW Measurements Manual

Chapter 19 Instrument Drivers in LabVIEW

Once you have verified basic communication with your instrument using the Getting Started VI, you probably want to customize instrument

control for your needs. If your application needs are similar to the Getting Started VI, the simplest means of creating a customized VI is to save a copy of the Getting Started VI by selecting File»Save As. You can change the default values on the front panel by selecting Operate»Make Current Values Default. Block diagram changes might include changing the constants wired to the Application VI or other sub-VIs.

Verifying VISA Communication

If no VISA VIs appear to be working in LabVIEW, including instrument drivers, the first step to take is the VISA Find Resource VI. This VI runs without any other VISA VIs in the block diagram. If this VI produces strange errors such as nonstandard VISA errors, the problem is most likely that the wrong version of VISA is installed or that VISA is not installed correctly. If VISA Find Resource runs correctly, LabVIEW is working correctly with the VISA driver. The next step is to identify what sequence of VIs is producing the error in the LabVIEW program.

If it is a simple sequence of events that is producing the error, a good next step in debugging is to try the same sequence interactively with the VISAIC utility. It is generally a good idea to do initial program development interactively. If the interactive utility works successfully but the same sequence in LabVIEW does not, it is an indication that LabVIEW might have a problem interacting with the VISA driver. If the same sequence exhibits the same problem interactively in VISAIC it is possible that a problem exists with one of the drivers VISA is calling. You can use the interactive utilities for these drivers, such as IBIC for NI-488.2, to try to perform the equivalent operations. If the problems persist on this level, it is an indication that there might be a problem with the lower-level driver or its installation.

LabVIEW Measurements Manual

19-8

www.ni.com

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