Saturday, September 25, 2010

Voltage Monitor VI

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

  1. Select File>>New, then select Template>>Frameworks>>Single Loop Application to open the Single Loop Application template VI.
  2. Build the front panel shown in Figure 1.
    Figure 1
    Figure 1 (voltmonfp.png)
    Use the following guidelines to help you construct the front panel.
    • Place a VISA resource name control, located on the Controls>>All Controls>>I/O palette, on the front panel.
    • Set the x-axis scale of the waveform chart to show incremental values.

Block Diagram

  1. Build the block diagram shown in Figure 2.
    Figure 2
    Figure 2 (voltmonbd.png)
    1. Create two shift registers by right-clicking the right or left border of the loop and selecting Add Shift Register from the shortcut menu.
    2. dvsiminiticon.png Place the NI DEVSIM Initialize VI, located on the Functions>>Input>>Instrument Drivers>>NI Device Simulator palette, on the block diagram. This VI opens communication between LabVIEW and the NI Instrument Simulator.
      • Right-click the ID Query input and select Create>>Constant from the shortcut menu. Use the Operating tool to change the constant to a False value.
      • Wire the Boolean constant to the Reset input.
    3. dvsimetericon.png Place the NI DEVSIM Multimeter Configuration VI, located on the Functions>>Input>>Instrument Drivers>>NI Device Simulator>>Configuration palette, 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.
    4. dvsimeasicon.png Place the NI DEVSIM Measure DC Voltage VI, located on the Functions>>Input>>Instrument Drivers>>NI Device Simulator>>Data palette, on the block diagram. This VI returns a simulated voltage measurement from the NI Instrument Simulator.
    5. dvsimclsicon.png Place the NI DEVSIM Close VI, located on the Functions>>Input>>Instrument Drivers>>NI Device Simulator palette, on the block diagram. This VI ends communication between LabVIEW and the NI Instrument Simulator.
    6. maxminicon.png Place the Max & Min function, located on the Functions>>All Functions>>Comparison palette, 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.
    7. Error.png Place the Simple Error Handler VI, located on the Functions>>All Functions>>Time & Dialog palette, on the block diagram. This VI displays a dialog box if an error occurs and displays the error information.
    8. unbundle.png Place the Unbundle by Name function, located on the Functions>>All Functions>>Cluster palette, on the block diagram. This function accepts status from the error cluster.
    9. or.png Place the Or function, located on the Functions>>Arithmetic & Comparison>>Express Boolean palette, on the block diagram. This function controls when the While Loop ends. If there is an error or you click the Stop button, the While Loop stops.
    10. EXtimedelay.png Set the wait for the Time Delay Express VI to 1 second.
    11. 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.
  2. Save the VI as Voltage Monitor.vi in the C:\Exercises\LabVIEW Basics I directory.
  3. Make sure the NI Instrument Simulator is powered on.
  4. 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.
  5. Stop and close the VI.

Content actions

GIVE FEEDBACK:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers