Saturday, September 25, 2010

Temperature Monitor VI

Summary: Use a While Loop and a waveform chart to acquire and display data.





EXERCISE 1

Complete the following steps to build a VI that measures temperature and displays it on a waveform chart.

1.A) Front Panel

  1. Open a blank VI and build the front panel shown in Figure 1.
    Figure 1
    Figure 1 (tempmon.png)
    1. Place the vertical toggle switch, located on the Controls>>Buttons & Switches palette, on the front panel. Label this switch Power. You use the switch to stop the acquisition.
    2. Place a waveform chart, located on the Controls>>Graph Indicators palette, on the front panel. Label the chart Temperature History. Thewaveform chart displays the temperature in real time.
    3. labeling.png The waveform chart legend labels the plot Plot 0. Use the Labeling tool to triple-click Plot 0 in the chart legend, and change the label to Temp.
    4. The temperature sensor measures room temperature. Use the Labeling tool to double-click 10.0 in the y-axis and type 90 to rescale the chart. Leave the x-axis in its default state.
    5. Change 10.0 in the y-axis to 70.
    6. Label the y-axis Temp (Deg F) and the x-axis Time (sec).

1.B) Block Diagram

  1. Select Window>>Show Block Diagram to display the block diagram.
  2. Enclose the two terminals in a While Loop, as shown in the block diagram.
    Figure 2
    Figure 2 (tempmonbd.png)
  3. Right-click the conditional terminal and select Continue if True.
  4. Wire the objects as shown in Figure 2.
    1. tempicon.png Place the Thermometer VI on the block diagram. Select Functions>>All Functions>>Select a VI and navigate to C:\Exercises\LabVIEW Basics I\Thermometer.vi. This subVI returns one temperature measurement from the temperature sensor.

      NOTE: 

      Use the (Demo) Thermometer VI if you do not have a DAQ device available.
    2. waitms.png Place the Wait Until Next ms Multiple function, located on the Functions>>All Functions>>Time & Dialog palette, on the block diagram.
    3. tempmonconst.png Right-click the millisecond multiple input of the Wait Until Next ms Multiple function, select Create>>Constant from the shortcut menu, type 500, and press the <Enter> key. The numeric constant specifies a wait of 500ms so the loop executes once every half-second.

      NOTE: 

      To measure temperature in Celsius, wire a Boolean True constant located on the Functions>>Arithmetic & Comparison>>Express Boolean palette to the Temp Scale input of the Thermometer VI. Change the scales on charts and graphs in subsequent exercises to a range of 20to 32 instead of 70 to 90.
  5. Save the VI as Temperature Monitor.vi in the C:\Exercises\LabVIEW Basics I directory.

1.C) Run the VI

  1. Display the front panel by clicking it or by selecting Window>>Show Front Panel.
  2. Use the Operating tool to click the vertical toggle switch and turn it to the ON position.
  3. Run the VI. The subdiagram within the While Loop border executes until the specified condition is True. For example, while the switch is on (True), the Thermometer VI takes and returns a new measurement and displays it on the waveform chart.
  4. Click the vertical toggle switch to stop the acquisition. The condition is False, and the loop stops executing.

1.D) Front Panel

  1. Format and customize the x- and y-scales of the waveform chart.
    1. Right-click the chart and select Properties from the shortcut menu to display the Chart Properties dialog box.
    2. Click the Format and Precision tab. Select Deg F (Y-axis) in the top pull-down menu. Set the Digits of precision to 1.
    3. Click the Plots tab and select different styles for the y-axis, as shown in Figure 3.
      Figure 3
      Figure 3 (chartprop2.png)
    4. Select the Scales tab and select the Time (sec) (X-axis) in the top pull-down menu. Set the scale options as shown in Figure 4. Set the Multiplier to 0.50to account for the 500 ms Wait function.
      Figure 4
      Figure 4 (chartprop3.png)
    5. In the Scales tab, select the Deg F (Y-axis) in the top pull-down menu. Set the scale options as shown in Figure 5.
      Figure 5
      Figure 5 (chartprop4.png)
    6. Click the OK button to close the dialog box when finished.
  2. Right-click the waveform chart and select Data Operations>>Clear Chart from the shortcut menu to clear the display buffer and reset the waveform chart.

    TIP: 

    When a VI is running, you can select Clear Chart from the shortcut menu.
  3. Each time you run the VI, you first must turn on the vertical toggle switch and then click the Run button due to the current mechanical action of the switch. Modify the mechanical action of the vertical toggle switch so temperature is plotted on the graph each time you run the VI, without having to first set the toggle switch.
    1. Stop the VI if it is running.
    2. Use the Operating tool to click the vertical toggle switch and turn it to the ON position.
    3. Right-click the switch and select Data Operations>>Make Current Value Default from the shortcut menu. This sets the ON position as the default value.
    4. latchpress.png Right-click the switch and select Mechanical Action>>Latch When Pressed from the shortcut menu. This setting changes the control value when you click it and retains the new value until the VI reads it once. At this point the control reverts to its default value, even if you keep pressing the mouse button. This action is similar to a circuit breaker and is useful for stopping While Loops or for getting the VI to perform an action only once each time you set the control.

1.E) Run the VI

  1. Run the VI.
  2. Use the Operating tool to click the vertical switch to stop the acquisition. The switch changes to the OFF position and changes back to ON after the conditional terminal reads the value.
  3. Save the VI. You will use this VI in the Temperature Running Average 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