Instrument I/O Assistant Explained

Publish Date: Aug 29, 2019 | 4 Ratings | 2.50 out of 5 | Print

Overview

NI LabVIEW expands your options for communicating with and controlling your instrumentation systems with the Instrument I/O Assistant.  Instrument I/O Assistant provides a user interface to interactively write commands to a device, read data that the device returns, and specify how to parse the response into a format relevant to your application.  Instrument I/O Assistant simplifies the challenge of writing instrument control applications by automatically generating code from your configurations in your environment. Instrument I/O Assistant also helps you quickly parse complex responses from an instrument for use in native-code instrument drivers. Because string parsing can be complex, using the assistant’s interactive window to parse complicated responses can save you time in creating your instrument application. This article describes how you can use the Instrument I/O Assistant to communicate with your instrument, as well as a debugging utility and a helpful tool to parse complex responses from your instrument.

Table of Contents

  1. How to Use the Instrument I/O Assistant
  2. Incorporate I/O Assistant Parsing in Your Instrument Drivers
  3. Summary

1. How to Use the Instrument I/O Assistant

The Instrument I/O Express VI, found on the Functions>>Instrument I/O palette, launches the Instrument I/O Assistant, which you can use to communicate with message-based instruments and graphically parse the response.  With the Instrument I/O Assistant, you can communicate with an instrument that uses a serial, Ethernet, or GPIB interface.  To use the assistant, place the Instrument I/O Assistant Express VI on the block diagram (Figure 1).  The interactive Instrument I/O Assistant dialog window appears (Figure 2). 

Note: You must install the Instrument I/O Assistant from the National Instruments Device Drivers CD in order to use the Instrument I/O Assistant Express VI.

Figure 1: Instrument I/O Assistant Express VI

IO assistant dialog.png

Figure 2: Instrument I/O Assistant Dialog Window

Navigating the Instrument I/O Assistant Dialog Window

Once the interactive Instrument I/O Assistant dialog appears, select your instrument from the Select an instrument drop-down list. LabVIEW automatically generates the list of instruments by making a ‘find resource’ call and checking Measurement and Automation Explorer (an I/O configuration utility) for any existing unique instrument names or aliases.  Instruments you configure in MAX automatically show up in the Select an instrument drop-down list.  You can search for instruments and assign unique names or aliases for your instruments through Measurement & Automation Explorer. These aliases will automatically show up in the Instrument I/O Assistant instrument pull-down menu.

The Instrument I/O Assistant organizes instrument communication into ordered steps.  To use the Instrument I/O Assistant, you place steps into a sequence.  Click the Add Step button to add steps to communicate with the instrument you select.  As you add steps to the sequence, they appear in the step sequence window. Use the view associated with a step to configure instrument I/O.  Four steps are available in the Instrument I/O Assistant.

  • Select Instrument—Use this step to select the instrument you want to communicate with and to configure basic instrument properties. This step appears in the step sequence window when you launch the Instrument I/O Assistant and must always be the first step in any Instrument I/O Assistant sequence.
  • Query and Parse—Use this step to send a command to the instrument, read a response from the instrument, and parse the returned data.
  • Write—Use this step to send a command to the instrument.
  • Read and Parse—Use this step to read a response from the instrument and parse the returned data.

For more information about configuring the steps, click Show Help to view the embedded help within the Instrument I/O Assistant.

Once you build a sequence of steps, you then execute the sequence to communicate with the instrument. When execution completes, use the response window in the Read and Parse view and Query and Parse view to interactively parse data into tokens and assign new data types to the tokens you create.

Configuring Instrument Parameters and Parsing Data

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 using the Write step in the Instrument I/O Assistant. You can also perform Query and Parse steps to send commands to the instrument and display the response in the interactive window. After you receive a response from an instrument, the Instrument I/O Assistant can parse the response for you automatically. The assistant converts the data into a more usable format, such as a waveform or numeric data type. Because parsing data is often the most tedious aspect of instrument programming, the Instrument I/O Assistant can save you significant development time when you create instrument control applications.

You also have the option to parse data manually using the Instrument I/O Assistant. You should use this method if you want to look at specific pieces of the returned data. You can assign tokens, or outputs, to each piece of data parsed. The outputs on the right-side of Figure 3 are the current tokens for this sequence of commands and responses. These tokens appear as outputs on the Instrument I/O Assistant Express VI and can pass data to an indicator, analysis VIs, or other VIs. You also can apply scaling for the tokens to convert the responses from an instrument into real-world data. Because parsing, formatting, and scaling data can 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.

Viewing the Results in LabVIEW

Once you have your steps added and configured, click Ok and LabVIEW automatically builds the VI in the background using the steps you configured in the dialog.  From the block diagram you can easily wire the Instrument I/O Assistant outputs to user interface indicators (Figure 3).  You can also convert Instrument I/O Assistant Express VIs to standard LabVIEW VIs in order to view the underlying code so you can further understand the parsing and formatting involved with sending these commands.


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

Back to Top

2. Incorporate I/O Assistant Parsing in Your Instrument Drivers

The Instrument I/O Assistant is not designed as a replacement for well-written, full-featured instrument drivers. For the majority of applications, the instrument driver code templates and other documentation available on ni.com/idnet should serve as the model for instrument drivers. However, the Instrument I/O Assistant delivers several benefits for both beginning and advanced instrument driver developers.

 

Easily Create Parsing Routines

The Instrument I/O Assistant helps to quickly parse complex responses from an instrument for use in their native-code instrument drivers. To parse the responses in the Instrument I/O Assistant window, close the assistant and right-click the Express VI. Select Open Front Panel from the shortcut menu to convert the Express VI to a standard VI. You can then copy the complex parsing routine to use in an instrument driver (Figure 4). Because parsing can be tricky, using the assistant to parse a set of complex code can save you valuable time in creating your instrument driver. 

IO assistant code.png

Figure 4 - Easily copy the parsing routines to use in your instrument driver.

 

Decrease Debugging Time

With the Instrument I/O Assistant, you can maintain a command history that makes remembering or retyping previous commands unnecessary. This feature can save significant time for experienced instrument driver developers trying to debug a piece of code or determine how an instrument responds under a certain set of parameters.  You can also check for instrument errors automatically instead of manually checking registers to determine errors. Finally, you can use the Instrument I/O Assistant to view parsed code as real data types (e.g., graphed waveforms) instead of ASCII or binary data. This feature can help you compare data real-time with what you see on an instrument's front panel. 

Back to Top

3. Summary

The Instrument I/O Assistant is a great tool  for communicating with instruments quickly and easily.  When used as a stand-alone express VI, it allows you to quickly establish communication with your instrument and begin taking measurements.  You can then easily display those measurements on the LabVIEW front panel in multiple real data types.  You can also use the Instrument I/O assistant to generate complex parsing routines to use in your instrument drivers.  This flexibility and scalability is just one of the many benefits you get when you choose LabVIEW as your instrument control solution.

 

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit