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
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.