Accelerate Instrument Control with Interactive Tools and LabVIEW

Publish Date: Jan 08, 2009 | 41 Ratings | 3.41 out of 5 | Print

Overview

One of the greatest frustrations when getting started with instrument control is verifying communication with your instruments. You may spend hours sifting through lengthy manuals and layers of menus on the instrument trying to find information about the instrument address and whether GPIB is enabled.

To alleviate this frustration, National Instruments provides a number of productivity tools that help you speed through this important start-up process so you can begin focusing on the most important aspect of your application building your tests.

This article describes various tools and techniques you can use to quickly get up and running with your GPIB instruments. Examples of how to use the interactive control utility, the LabVIEW Instrument Wizard, and Instrument I/O Assistant will provide you with the skills you need to quickly tackle your next GPIB test application.

Table of Contents

  1. Using the VISA Interactive Control(VISAIC) to Get Started
  2. Quickly Determining GPIB Addresses
  3. Establishing Communication with Your Instruments
  4. An Easy Way to Troubleshoot Instrument, Cable, and Power Problems
  5. LabVIEW Instrument Wizards Automate Interactive Control
  6. Scanning the System for Instruments
  7. Managing Instrument Drivers
  8. Instrument I/O Assistant
  9. Conclusion

 Print

Overview

One of the greatest frustrations when getting started with instrument control is verifying communication with your instruments. You may spend hours sifting through lengthy manuals and layers of menus on the instrument trying to find information about the instrument address and whether GPIB is enabled.

To alleviate this frustration, National Instruments provides a number of productivity tools that help you speed through this important start-up process so you can begin focusing on the most important aspect of your application building your tests.

This application note describes various tools and techniques you can use to quickly get up and running with your GPIB instruments. Examples of how to use the interactive control utility, the LabVIEW Instrument Wizard, and Instrument I/O Assistant will provide you with the skills you need to quickly tackle your next GPIB test application.

 

1. Using the VISA Interactive Control(VISAIC) to Get Started

The VISA Interactive Control (VISAIC), is a standard software utility included with National Instruments GPIB controller products. Using your computer, you can use this powerful development and debugging tool to interactively communicate (read, write, serial poll, etc.) with your GPIB instruments. With the VISAIC utility, you can speed up application development by learning how to automate measurements with your instruments, uncover GPIB problems, and avoid headaches by identifying malfunctioning instruments. For Windows platforms, the VISAIC utility comes complete with on-line help that describes the applicable NI-488 functions and NI-488.2 routines, syntax, error codes, and status variables that provide you with the debugging information you need to solve problems.

For a detailed discussion on how to use the VISAIC utility and the functions used in the examples, refer VISA help file and NI-488.2 help file, respectively, that came with your GPIB controller. The following sections assume a basic knowledge of the VISAIC utility and GPIB.  

Back to Top

2. Quickly Determining GPIB Addresses


When VISAIC initially runs, it automatically finds all of the available resources in the system and lists the instrument descriptors for each resource under the appropriate resource type. The figure below shows the VISAIC opening window.


Figure 1. Visa Interactive Control

For instruments to be recognized, they must be powered on and connected to the GPIB controller via cable. If you have two or more instruments on the bus, you can disconnect all instruments except one to determine its address. By isolating each instrument on the bus and repeatedly Refreshing (View » Refresh) , you can quickly determine the address of each instrument. You could also use "Resource to Find" field and this will query each instrument for an identification (ID) string. ID querying is discussed in a section to follow.

Back to Top

3. Establishing Communication with Your Instruments


Once you have determined the GPIB address of your instruments, it is easy to establish communications to verify that you can send and receive data to and from the instrument. Because most instruments are 488.2 compliant, you can query the instrument for its identification by sending it “*IDN?.” Instruments will typically respond with the manufacturer’s name, model name, and various alphanumeric characters that the manufacturer uses to track firmware revisions. To communicate with our fictitious instrument at address 10,  we will follow these instructions:

First, double-click the instrument in the VISAIC that you would like to communicate with, in our case GPIB1 :: 10::INSTR.

This will open up a VISA Test Panel for our instrument. This Test Panel will allow us to set properties for our instrument communication as well as read and write to the instrument.


Figure 2. VISA Test Panel

From the viWrite tab,  if we put *IDN?\n and then click Execute. This will send the 488.2 identification command "*IDN?" to our instrument followed by a termination character "\n"

Now from the viRead tab, select a count of 100, the length of our expected response. and then hit execute, our instrument should return an identification string.

Back to Top

4. An Easy Way to Troubleshoot Instrument, Cable, and Power Problems


Many times systems are powered down and cables are disconnected from instruments for maintenance or to change the configuration of the system. Unfortunately, engineers sometimes forget to reconnect all the cables and power up all the instruments. Alternatively, system power may be disrupted for a variety of reasons or the actual instrument may begin to malfunction. VISAIC is also convenient for verifying that your instruments are still “alive” on the bus. Simply use the Refresh (View » Refresh) to check if a particular instrument is listening at its assigned GPIB address. If it is not, then you know to check cables, power, and verify that the instrument is working properly.


If there was a problem you would get no longer see your device, notifying you to check for loose or disconnected cables, power disruption, or a malfunctioning instrument.

The basic functions and concepts described above may seem simplistic; however they can be invaluable in troubleshooting and getting your GPIB system up and running. These productivity tools help you focus on developing your test applications to avoid frustration in trying to track down obscure problems or establishing communications with your instruments.  

Back to Top

5. LabVIEW Instrument Wizards Automate Interactive Control


To get your job done, you need a fast way to find GPIB listeners and establish communication to ensure the GPIB system is working properly. Once this is done, you need a fast way of going from interactive mode to programming mode so you can directly begin writing your tests without a tedious transition process.

The LabVIEW Instrument Wizard addresses this by automating and integrating, directly inside of LabVIEW, some of the start-up tips discussed above. With the new instrument wizards, you save time in developing instrument control applications because LabVIEW automatically identifies the instruments connected, installs appropriate instrument driver libraries for programming, and then launches an application example to verify communication. The application example is generated using the installed instrument driver so you have a template from which to begin your own customized test applications.

The following is an example of how you might use the instrument wizard to start up your GPIB system. In this case we have added two unknown devices to the system.

Back to Top

6. Scanning the System for Instruments


Once you have launched the instrument wizard, LabVIEW scans the system for GPIB instruments as well as VXI, RS-232, and computer-based instruments. LabVIEW identifies new GPIB objects in the system as a device until you use the “Identify Device” button to query the device for more specific information. By default, “Identify Device” sends a “*IDN?” query to the instrument, you can still download instrument drivers if it does not respond to "*IDN?". LabVIEW then reads back the response of the device and updates the label in the instrument tree to reflect this information. In this case, we have identified one new instruments – a Fluke PM6685.


Figure 3. The Instrument Wizard

Back to Top

7. Managing Instrument Drivers


After you have identified the instruments in your system, LabVIEW can help you locate the appropriate Instrument Driver. Here you can search and download drivers as well as manage drivers.  As you can see, we have additional instrument drivers already installed in our system for other Instrument. Instrument drivers are powerful pieces of software that combine the granular, low-level command strings needed for configuration and measurement into higher-level functions such as initialize, reset, and read waveform. Instrument libraries make instrument control easier and help you focus on taking measurements, developing complete tests, and making decisions, versus learning the nuts and bolts of how to make your instrument make a measurement. National Instruments provides a complete selection of the most popular instrument drivers requested by users today. For more information or to request additional instrument drivers visit the National Instruments Instrument Driver Network.


As you can see, the LabVIEW Instrument Wizard is designed to guide you through the discovery process of adding instrumentation to your system. By automating detection, query, and instrument driver installation, you can quickly get your system up and running and then begin focusing on building your actual test applications.

 

Back to Top

8. Instrument I/O Assistant


Instrument I/O Assistant is available from the Input and Output Express palettes in LabVIEW. With the assistant you can quickly and easily send commands to your instrument and view the responses real-time. To use the assistant, place the Instrument I/O Assistant Express VI on the block diagram (see Figure 4) and the interactive window automatically appears.


Figure 4. Instrument I/O Assistant Express VI

Once the interactive Instrument I/O Assistant dialog appears, select your instrument from the drop-down instrument list and then add steps to communicate with the instrument. The list of instruments is generated automatically by making a 'find resource' call and checking the Measurement & Automation Explorer, an I/O configuration utility, for any existing unique instrument names or aliases. You can search for instruments and assign unique names or aliases for your instruments through Measurement & Automation Explorer that will automatically show up in the Instrument I/O Assistant instrument pull-down menu.



Figure 5. Interactive Instrument I/O Assistant Dialog

You may want to configure specific parameters on your instrument, such as triggering or coupling, before you read back measurement data. You can write these specific commands with the write step in the Instrument I/O Assistant. You can also perform query and parse steps to send commands to the instrument and automatically display the response in the interactive window. After you receive a response from the instrument, the Instrument I/O Assistant can parse the response for you, therefore automatically converting the data into a more useable format, such as waveform or numeric data types. Because parsing data is usually the most tedious aspect of instrument programming, Instrument I/O Assistant can save you significant development time in your instrument control applications.

In addition to automatically parsing data, you can manually parse data using the Instrument I/O Assistant in case you just want to look at specific pieces of the data returned. With each piece of data parsed you can assign tokens, or outputs, for the parsed values. The outputs on the right-side of Figure 6 are the current tokens for this sequence of commands and responses. These tokens appear as outputs on the Instrument I/O Assistant Express VI on the block diagram and can pass data to an indicator, analysis VIs, or other VIs as shown in the Figure 6. Moreover, you can apply scaling for your tokens to convert the responses from your instrument into real-world data. Because parsing, formatting, and scaling data can sometimes be a difficult task with instrument communication, the Instrument I/O Assistant delivers automatic, interactive parsing and scaling so you can convert your instrument data correctly without extensive debugging.



Figure 6. Easily wire the Instrument I/O Assistant outputs to user interface indicators.


Finally you can convert your Instrument I/O Assistant Express VIs to standard LabVIEW VIs to view the underlying code and further understand the parsing and formatting involved with sending these commands.

Back to Top

9. Conclusion


Interactive control, the LabVIEW Instrument Wizard, and Instrument I/O Assistant are innovative tools that make your task of instrument control easier. The interactive control utility is a powerful tool for doing quick interactions and troubleshooting with your instruments. To automate interactive control, use the LabVIEW Instrument Wizard so you can quickly move from interactive to programming mode and begin building real test solutions with your instruments. Instrument I/O Assistant is a great tool to communicate with instruments when an instrument driver is not available. Furthermore the assistant can be used to assist instrument driver developers as a good replacement for other tools and in creating complex parsing routines.
Related Links:
Instrument Driver Network

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit