This page is optimized for mobile devices, if you would prefer the desktop version just
click here
To read a temperature once every second for one minute.
Complete the following steps to build a VI that uses the Thermometer VI to read a temperature once every second for aduration of one minute.
Front panel
- Open a blank VI and build the front panel shown in
.
- Place a
thermometer
, located on theControls>>Numeric Indicators
palette, on the front panel. This provides a visual indication ofthe temperature reading. - Place a
numeric indicator
, located on theControls>>Numeric Indicators
palette, on the front panel. Label this indicatorSeconds Elapsed
. Right-click the indicator and selectRepresentation>>I32
from the shortcut menu.
- Place a
Block diagram
- Build the block diagram shown in
.
- Place a
For Loop
, located on theFunctions>>All Functions>>Structures
palette, on the block diagram. Right-click theLoop Count
terminal in the upper left corner of theFor Loop
and selectCreate Constant
from the shortcut menu. Type60
in the constant to set theFor Loop
to repeat 60 times. - Place the
Thermometer
VI on the block diagram. SelectFunctions>>All Functions>>Select a VI
and navigate toC:\Exercises\LabVIEW Basics I\Thermometer.vi
to place the VI. This VI reads the temperature from the DAQ device. Right-clicktheTemp Scale
input and selectCreate>>Constant
from the shortcut menu. Use aFalse
constant for Fahrenheit or aTrue
constant for Celsius.If you do not have a DAQ device with a temperature sensoron Channel 0, use the(Demo) Thermometer
VI instead. - Place the
Wait Until Next ms Multiple
function, located on theFunctions>>All Functions>>Time&Dialog
palette, on the block diagram. Right-click the input and selectCreate>>Constant
from the shortcut menu. Enter a value of1000
to set the wait to every second. - Place the
Increment
function, located on theFunctions>>Arithmetic&Comparison>>Express Numeric
palette, on the block diagram. This function adds one to theiteration terminal output.
- Place a
- Save this VI as
Timed Temperature.vi
in theC:\Exercises\LabVIEW Basics I
directory. - Run the VI. The first reading might take longer than onesecond to retrieve if the computer needs to configure the DAQ device.
- If time permits, complete the following optional andchallenge steps, otherwise close the VI.
Optional
- Build a VI that generates random numbers in a
While Loop
and stops when you click a stop button on the front panel. - Save the VI as
General While Loop.vi
in theC:\Exercises\LabVIEW Basics I
directory.
Challenge
- Modify the
General While Loop
VI to stop when the stop button is clicked or when theWhile Loop
reaches a number of iterations specified by a front panel control. - Select
File>>Save As
to save the VI asCombo While-For Loop.vi
in theC:\Exercises\LabVIEW Basics I
directory.
Read also:
OpenStax, Labview graphical programming. OpenStax CNX. Apr 09, 2015 Download for free at https://legacy.cnx.org/content/col11408/1.2
Google Play and the Google Play logo are trademarks of Google Inc.