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 & Switches
palette, on the front panel. Label this switchPower
. You use the switch to stop the acquisition. - Place a
waveform chart
, located on theControls>>Graph Indicators
palette, on the front panel. Label the chartTemperature History
. Thewaveform chart
displays the temperature in real time. - The
waveform chart
legend
labels the plotPlot 0
. Use theLabeling
tool to triple-clickPlot 0
in the chart legend, and change the label toTemp
. - 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. - 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 Diagram
to display the block diagram. - Enclose the two terminals in a While Loop, as shown in the block diagram.
Figure 2 - Right-click the
conditional
terminal and selectContinue if True
. - Wire the objects as shown in Figure 2.
- Place the
Thermometer
VI on the block diagram. SelectFunctions>>All Functions>>Select a VI
and navigate toC:\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. - Place the
Wait Until Next ms Multiple
function, located on theFunctions>>All Functions>>Time & Dialog
palette, on the block diagram. - Right-click the
millisecond multiple
input of theWait Until Next ms Multiple
function, selectCreate>>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 BooleanTrue
constant located on theFunctions>>Arithmetic & Comparison>>Express Boolean
palette to theTemp Scale
input of theThermometer
VI. Change the scales on charts and graphs in subsequent exercises to a range of 20to 32 instead of 70 to 90.
- Place the
- Save the VI as
Temperature Monitor.vi
in theC:\Exercises\LabVIEW Basics I
directory.
1.C) Run the VI
- Display the front panel by clicking it or by selecting
Window>>Show Front Panel
. - Use the
Operating
tool to click the vertical toggle switch and turn it to theON
position. - Run the VI. The subdiagram within the
While Loop
border executes until the specified condition isTrue
. For example, while the switch is on (True
), theThermometer
VI 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
Properties
from the shortcut menu to display theChart Properties
dialog box. - Click the
Format and Precision
tab. SelectDeg F (Y-axis)
in the top pull-down menu. Set theDigits of precision
to 1. - Click the
Plots
tab and select different styles for the y-axis, as shown in Figure 3.Figure 3 - Select the
Scales
tab and select theTime (sec) (X-axis)
in the top pull-down menu. Set the scale options as shown in Figure 4. Set theMultiplier
to 0.50to account for the500 ms Wait
function.Figure 4 - In the
Scales
tab, select theDeg F (Y-axis)
in the top pull-down menu. Set the scale options as shown in Figure 5.Figure 5 - Click the
OK
button to close the dialog box when finished.
- Right-click the chart and select
- Right-click the
waveform chart
and selectData Operations>>Clear Chart
from the shortcut menu to clear the display buffer and reset thewaveform chart
.TIP:
When a VI is running, you can selectClear Chart
from the shortcut menu. - 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.- Stop the VI if it is running.
- Use the
Operating
tool to click the vertical toggle switch and turn it to theON
position. - Right-click the switch and select
Data Operations>>Make Current Value Default
from the shortcut menu. This sets theON
position as the default value. - 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 stoppingWhile Loops
or 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
Operating
tool to click the vertical switch to stop the acquisition. The switch changes to theOFF
position and changes back toON
after theconditional
terminal reads the value. - Save the VI. You will use this VI in the Temperature Running Average VI.
No comments:
Post a Comment