Summary: Use a While Loop and a waveform chart to acquire and display data.
![]() Figure 1 |
Controls>>Buttons & Switches palette,
on the front panel. Label this switch
Power. You use the switch to stop the
acquisition.
waveform chart, located on the
Controls>>Graph Indicators palette, on the
front panel. Label the chart Temperature
History. The waveform chart displays
the temperature in real time.
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.
Labeling tool to double-click
Temp (Deg
F) and the x-axis Time (sec).
Window>>Show Block Diagram to display
the block diagram.
![]() Figure 2 |
conditional terminal and select
Continue if True.
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.
(Demo) Thermometer VI if you do
not have a DAQ device available.
Place the Wait Until Next ms Multiple
function, located on the Functions>>All
Functions>>Time & Dialog palette, on the
block diagram.
Right-click the millisecond multiple
input of the Wait Until Next ms
Multiple function, select
Create>>Constant from the shortcut
menu, type <Enter> key. The numeric
constant specifies a wait of
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 Temperature Monitor.vi in the
C:\Exercises\LabVIEW Basics I directory.
Window>>Show Front Panel.
Operating tool to click the vertical
toggle switch and turn it to the ON position.
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.
False, and the
loop stops executing.
Properties
from the shortcut menu to display the Chart
Properties dialog box.
Format and Precision tab. Select
Deg F (Y-axis) in the top pull-down
menu. Set the Digits of precision to
Plots tab and select different
styles for the y-axis, as shown in Figure 3.
![]() Figure 3 |
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
500 ms Wait function.
![]() Figure 4 |
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 |
OK button to close
the dialog box when finished.
waveform chart and select
Data Operations>>Clear Chart from the shortcut
menu to clear the display buffer and reset the
waveform chart.
Clear
Chart from the shortcut menu.
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.
Operating tool to click the
vertical toggle switch and turn it to the
ON position.
Data
Operations>>Make Current Value Default from the
shortcut menu. This sets the ON 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
stopping While Loops or for getting the VI
to perform an action only once each time you set the
control.
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.
Comments, questions, feedback, criticisms?
"A full introductory course on programming with LabVIEW."