<< Chapter < Page | Chapter >> Page > |
Complete the following steps to create a VI that reads a measurement from the temperature sensor on the DAQ SignalAccessory and displays the temperature in Celsius or Fahrenheit.
The sensor returns a voltage proportional to temperature. For example, if the temperature is 23, the sensor output voltage is 0.23 V. The sensor is connected to Channel 0 ofDevice 1. Device 1 is the DAQ device. On some systems, the DAQ device may have another device number.
LabVIEW
dialog box, click the arrow on
the
New
button and select
Blank
VI from the shortcut menu or press the
<Ctrl-N>
keys to open a blank VI.Controls>>Numeric Indicators
palette, on the
front panel.Temperature
in the label and press
the
<Enter>
key or click the
Enter
button on the toolbar, shown at left.Visible
Items>> Digital Display
from the shortcut menu to
show the digital display for the thermometer.Controls>>Buttons&Switches
palette, on the front panel.Temp Scale
in the label and press the
<Enter>
key or click the
Enter
button.Labeling
tool, shown in
, to place a free label,
deg
C
, next to the
True
position of the
switch. If you are using automatic tool selection,double-click the blank area of the front panel to begin
typing a free label.deg F
, next to the
False
position of the switch.Context
Help
window when you move the cursor over the VI icon.
File>>VI Properties
to
display the
VI Properties
dialog box.Documentation
from the
Category
pull-down menu.VI description
text box:
This VI measures temperature using the temperaturesensor on the DAQ Signal Accessory.
OK
button.Context Help
window when
you move the cursor over the objects and tip strips appear onthe front panel
or block diagram when you move the cursor over the objects whilethe VI runs.
Description and Tip
from the shortcut menu.Description
text box:
Displays the temperature measurement.
temperature
in the
Tip
text box.OK
button.Description and Tip
from the shortcut menu.Description
text
box:
Determines the scale (Fahrenheit or Celsius) to
use for the temperature measurement.
scale - C or F
in the
Tip
text box.OK
button.Help>>Show Context Help
to display the
Context Help
window.Context Help
window.Window>>Show Block Diagram
to display the
block diagram .
DAQ Assistant
Express VI, located on the
Functions>>Input
palette, on the block diagram.
When you place this Express VI on the block diagram the DAQAssistant configuration dialog box appears.
Analog Input>>Voltage
for the type of
measurement to make.Dev1>>ai0
(or
Dev2>>ai0
) for the physical channel and
click the
Finish
button.Settings
tab, select
Custom Scaling>>Create
New
. Select a
Linear
scale. Name
the scale
Temperature
. Enter a
slope
scale
of
100
. Click the
OK
button.min = 0
. Set
max = 100
Acquire 1 Sample
option on the
Task Timing
tab.
Click the
OK
button.
(Demo) Read Voltage
VI, located in the
C:\Exercises LabVIEW Basics I
directory.Convert from Dynamic Data
Express VI, located
on the
Functions>>Signal Manipulation
palette,
on the block diagram. This VI converts the dynamic datatype. In the configuration dialog box, select
Single
scalar
in the
Resulting data type
listbox.Convert C to F
VI on the block diagram. Select
Functions>>All Functions>>Select a VI
, navigate
to
C:\Exercises\LabVIEW Basics I\Convert C to
F.vi
. This VI converts the Celsius readings to
Fahrenheit.Select
function, located on the
Functions>>Arithmetic&Comparison>>Express
Comparison
palette, on the block diagram. This
function returns either the Fahrenheit (
False
)
or Celsius (
True
) temperature value, depending
on the value of
Temp Scale
. Use the
Positioning
tool to place the icons as shown in
the
block diagram and use the
Wiring
tool to wire them together.
Visible Items>>Terminals
from the
shortcut menu.Window>>Show Front Panel
.Run Continuously
button, shown at left, to run
the VI continuously.Run Continuously
button again to
stop the VI. This allows the VI to finish the current run ofthe VI.Thermometer
VI as a subVI. The following icon is an example. If
necessary, create a simpler icon to save time.
Edit
Icon from the shortcut menu. The
Icon Editor
dialog box appears.Select
tool, shown at left, on the left
side of the
Icon Editor
dialog box to
select the default icon.<Delete>
key to remove the
default icon.Rectangle
tool, shown at
, to redraw the border.Pencil
tool, shown in
, to draw an icon that represents the
thermometer.Foreground and Fill
tools to color
the thermometer red.
<Shift>
key while you use the
Pencil
tool to drag the cursor.Text
tool, shown in
, and change the font to
Small
Fonts
.Temp
. Reposition the text if
necessary.B&W
icon and select
256 Colors
in the
Copy from
section to create a black and white icon, which LabVIEW
uses for printing unless you have a color printer.OK
button. The icon appears in the upper right corner of
the front panel.Show Connector
from the shortcut menu and assign terminals to the switch
and the thermometer.
Temp Scale
control. The left
terminal turns green.Temperature
indicator. The right
terminal turns orange.Thermometer.vi
in the
C:\Exercises\ LabVIEW Basics I
directory.You
will use this VI later in the course.Notification Switch
Would you like to follow the 'Labview graphical programming' conversation and receive update notifications?