Summary: To build a VI using the Convert C to F subVI to read a temperature from the DAQ Signal Accessory in Celsius or Fahrenheit.
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.
![]() Figure 1 |
Controls>>Numeric Indicators palette, on the
front panel.
Type 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.
Use the
Labeling tool, shown in 3, 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 temperature
sensor on the DAQ Signal Accessory.
OK button.
Context Help window when
you move the cursor over the objects and tip strips appear on
the front panel
or block diagram when you move the cursor over the objects while
the VI runs.
| - |
Right-click the thermometer indicator and select
Description and Tip from the shortcut menu.
| |
| - |
Type the following description for the thermometer in the
Description text box:
Displays the temperature measurement.
| |
| - |
Type temperature in the
Tip text box.
| |
| - |
Click the OK button.
| |
| - |
Right-click the switch control and select
Description and Tip from the shortcut menu.
| |
| - |
Type the following description for the vertical
switch control in the Description text
box:
Determines the scale (Fahrenheit or Celsius) to
use for the temperature measurement.
| |
| - |
Type scale - C or F in the Tip
text box.
| |
| - |
Click the OK button.
|
Help>>Show Context Help to display the
Context Help window.
Context Help window.
Window>>Show Block Diagram to display the
block diagram.
![]() Figure 2 |
Place the
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 DAQ
Assistant 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.
Place the
Convert from Dynamic Data Express VI, located
on the Functions>>Signal Manipulation palette,
on the block diagram. This VI converts the dynamic data
type. In the configuration dialog box, select Single
scalar in the Resulting data type
listbox.
Place the
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.
Place the
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 .
Click the
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 of
the VI.
Thermometer
VI as a subVI. The following icon is an example. If
necessary, create a simpler icon to save time.
Figure 3 |
Edit Icon from the shortcut menu. The
Icon Editor dialog box appears.
Double-click
the 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.
Double-click
the Rectangle tool, shown at 12, to redraw the border.
Use
the Pencil tool, shown in 13, 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.
Double-click the Text tool, shown in 14, 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.
Comments, questions, feedback, criticisms?
"A full introductory course on programming with LabVIEW."