Summary: In this exercise, the objective is to build a VI that uses the Instrument I/O Assistant to communicate with a GPIB interface. Complete the following steps to build a VI that acquires data from the NI Instrument Simulator.
EXERCISE 1
1.A) Front Panel
- Open a blank VI.
- The front panel in Figure 1 will result from building the block diagram.
Figure 1
1.B) Block Diagram
- Display and build the block diagram shown in Figure 2.
Figure 2 - Place the
Instrument I/O Assistant
Express VI, located on theFunctions>>Input
palette, on the block diagram. Complete the following steps to configure the Express VI in theInstrument I/O Assistant
dialog box.
- Select
devsim
from theSelect an instrument
pull-down menu and selectVISA Code Generation
from theCode generation type
pull-down menu. - Click the
Add Step
button. ClickQuery and Parse
to write and read from the Instrument Simulator. - Type
*IDN?
as the command, select\n
as theTermination character
, and click theRun this step
button. If no error warning appears in the lower half of the dialog box, this step has successfully completed. - To parse the data received, click the
Auto parse
button. Notice thatToken
now appears in theOutputs
pane on the left side of the dialog box. This value represents the string returned from the identification query. RenameToken
by typingID String
in theToken name
text box. - Click the
Add Step
button. ClickQuery and Parse
. TypeMEAS:DC?
as the command and click theRun this step
button. - To parse the data received, click the
Auto parse
button. The data returned is a random numeric value. RenameToken
by typingVoltage
in theToken name
text box. - Click the
OK
button to exit theI/O Assistant
and return to the block diagram.
- Select
- Right-click the
ID String
output and selectCreate>>Indicator
from the shortcut menu. - Right-click the
Voltage
output and selectCreate>>Indicator
from the shortcut menu. - Wire the
Error Out
output to theSimple Error Handler
VI.
- Place the
- Display the front panel and run the VI. Resize the string indicator if necessary.
- Save the VI as
Read Instrument Data.vi
in theC:\Exercises\LabVIEW Basics I
directory. - Right-click the
I/O Assistant
and selectOpen Front Panel
. Click theConvert
button when asked if you want to convert to a subVI. - View the code generated by the
I/O Assistant
. Where is the command*IDN?
written to the Instrument Simulator? Where is the voltage being read? - Select
File>>Exit
to exit the subVI. Do not save changes.
No comments:
Post a Comment