Summary: In this exercise, the objective is to build a VI that uses the DevSim instrument driver VIs to acquire and plot voltages. Complete the following steps to build a VI that acquires a DC voltage measurement from the NI Instrument Simulator once every second and plots it in a waveform chart until you click a button. As each value is acquired, the VI compares it with the previous minimum and maximum values. The VI calculates and displays the minimum and maximum values continuously on the front panel.
Front Panel
- Select
File>>New, then selectTemplate>>Frameworks>>Single Loop Applicationto open theSingle Loop Application templateVI. - Build the front panel shown in Figure 1.Use the following guidelines to help you construct the front panel.
Figure 1 - Place a VISA resource name control, located on the
Controls>>All Controls>>I/Opalette, on the front panel. - Set the x-axis scale of the waveform chart to show incremental values.
- Place a VISA resource name control, located on the
Block Diagram
- Build the block diagram shown in Figure 2.
Figure 2 - Create two shift registers by right-clicking the right or left border of the loop and selecting
Add Shift Registerfrom the shortcut menu. Place the
NI DEVSIM InitializeVI, located on theFunctions>>Input>>Instrument Drivers>>NI Device Simulatorpalette, on the block diagram. This VI opens communication between LabVIEW and the NI Instrument Simulator.- Right-click the
ID Queryinput and selectCreate>>Constantfrom the shortcut menu. Use theOperatingtool to change the constant to aFalsevalue. - Wire the Boolean constant to the
Resetinput.
- Right-click the
Place the
NI DEVSIM Multimeter ConfigurationVI, located on theFunctions>>Input>>Instrument Drivers>>NI Device Simulator>>Configurationpalette, on the block diagram. This VI configures the range of voltage measurements that the NI Instrument Simulator generates. The default is 0.0 to 10.0 V DC.Place the
NI DEVSIM Measure DC VoltageVI, located on theFunctions>>Input>>Instrument Drivers>>NI Device Simulator>>Datapalette, on the block diagram. This VI returns a simulated voltage measurement from the NI Instrument Simulator.Place the
NI DEVSIM CloseVI, located on theFunctions>>Input>>Instrument Drivers>>NI Device Simulatorpalette, on the block diagram. This VI ends communication between LabVIEW and the NI Instrument Simulator.Place the
Max & Minfunction, located on theFunctions>>All Functions>>Comparisonpalette, on the block diagram. Use two of these functions to check the current voltage against the minimum and maximum values stored in the shift registers.Place the
Simple Error HandlerVI, located on theFunctions>>All Functions>>Time & Dialogpalette, on the block diagram. This VI displays a dialog box if an error occurs and displays the error information.Place the
Unbundle by Namefunction, located on theFunctions>>All Functions>>Clusterpalette, on the block diagram. This function accepts status from the error cluster.Place the
Orfunction, located on theFunctions>>Arithmetic & Comparison>>Express Booleanpalette, on the block diagram. This function controls when theWhile Loopends. If there is an error or you click theStopbutton, theWhile Loopstops.Set the wait for the
Time DelayExpress VI to 1 second.- Wire the block diagram as shown in Figure 2.
NOTE:
You do not need to wire every terminal for each node. Wire only the necessary inputs for each node, such as instrument descriptor, VISA session, and error I/O.
- Create two shift registers by right-clicking the right or left border of the loop and selecting
- Save the VI as
Voltage Monitor.viin theC:\Exercises\LabVIEW Basics Idirectory. - Make sure the NI Instrument Simulator is powered on.
- Display the front panel and run the VI. The LEDs alternate between Listen and Talk as LabVIEW communicates with the GPIB instrument once a second to get a simulated voltage reading. This voltage displays on the chart, and the minimum and maximum values update accordingly.
- Stop and close the VI.
No comments:
Post a Comment