EXERCISE 1
Complete the following steps to build a VI that measures temperature and displays it on a waveform chart.
1.A) Front Panel
- Open a blank VI and build the front panel shown in Figure 1.
Figure 1 - Place the vertical toggle switch, located on the
Controls>>Buttons & Switchespalette, on the front panel. Label this switchPower. You use the switch to stop the acquisition. - Place a
waveform chart, located on theControls>>Graph Indicatorspalette, on the front panel. Label the chartTemperature History. Thewaveform chartdisplays the temperature in real time. The
waveform chartlegendlabels the plotPlot 0. Use theLabelingtool to triple-clickPlot 0in the chart legend, and change the label toTemp.- The temperature sensor measures room temperature. Use the
Labelingtool to double-click 10.0 in the y-axis and type 90 to rescale the chart. Leave the x-axis in its default state. - Change −10.0 in the y-axis to 70.
- Label the y-axis
Temp (Deg F)and the x-axisTime (sec).
- Place the vertical toggle switch, located on the
1.B) Block Diagram
- Select
Window>>Show Block Diagramto display the block diagram. - Enclose the two terminals in a While Loop, as shown in the block diagram.
Figure 2 - Right-click the
conditionalterminal and selectContinue if True. - Wire the objects as shown in Figure 2.
Place the
ThermometerVI on the block diagram. SelectFunctions>>All Functions>>Select a VIand navigate toC:\Exercises\LabVIEW Basics I\Thermometer.vi.This subVI returns one temperature measurement from the temperature sensor.NOTE:
Use the(Demo) ThermometerVI if you do not have a DAQ device available.Place the
Wait Until Next ms Multiplefunction, located on theFunctions>>All Functions>>Time & Dialogpalette, on the block diagram.Right-click the
millisecond multipleinput of theWait Until Next ms Multiplefunction, selectCreate>>Constantfrom 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 BooleanTrueconstant located on theFunctions>>Arithmetic & Comparison>>Express Booleanpalette to theTemp Scaleinput of theThermometerVI. Change the scales on charts and graphs in subsequent exercises to a range of 20to 32 instead of 70 to 90.
- Save the VI as
Temperature Monitor.viin theC:\Exercises\LabVIEW Basics Idirectory.
1.C) Run the VI
- Display the front panel by clicking it or by selecting
Window>>Show Front Panel. - Use the
Operatingtool to click the vertical toggle switch and turn it to theONposition. - Run the VI. The subdiagram within the
While Loopborder executes until the specified condition isTrue. For example, while the switch is on (True), theThermometerVI takes and returns a new measurement and displays it on thewaveform chart. - Click the vertical toggle switch to stop the acquisition. The condition is
False, and the loop stops executing.
1.D) Front Panel
- Format and customize the x- and y-scales of the waveform chart.
- Right-click the chart and select
Propertiesfrom the shortcut menu to display theChart Propertiesdialog box. - Click the
Format and Precisiontab. SelectDeg F (Y-axis)in the top pull-down menu. Set theDigits of precisionto 1. - Click the
Plotstab and select different styles for the y-axis, as shown in Figure 3.Figure 3 - Select the
Scalestab and select theTime (sec) (X-axis)in the top pull-down menu. Set the scale options as shown in Figure 4. Set theMultiplierto 0.50to account for the500 ms Waitfunction.Figure 4 - In the
Scalestab, select theDeg F (Y-axis)in the top pull-down menu. Set the scale options as shown in Figure 5.Figure 5 - Click the
OKbutton to close the dialog box when finished.
- Right-click the chart and select
- Right-click the
waveform chartand selectData Operations>>Clear Chartfrom the shortcut menu to clear the display buffer and reset thewaveform chart.TIP:
When a VI is running, you can selectClear Chartfrom the shortcut menu. - Each time you run the VI, you first must turn on the vertical toggle switch and then click the
Runbutton 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.- Stop the VI if it is running.
- Use the
Operatingtool to click the vertical toggle switch and turn it to theONposition. - Right-click the switch and select
Data Operations>>Make Current Value Defaultfrom the shortcut menu. This sets theONposition as the default value. Right-click the switch and select
Mechanical Action>>Latch When Pressedfrom 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 stoppingWhile Loopsor for getting the VI to perform an action only once each time you set the control.
1.E) Run the VI
- Run the VI.
- Use the
Operatingtool to click the vertical switch to stop the acquisition. The switch changes to theOFFposition and changes back toONafter theconditionalterminal reads the value. - Save the VI. You will use this VI in the Temperature Running Average VI.
No comments:
Post a Comment