Beruflich Dokumente
Kultur Dokumente
2: Create a VI
Theory
VIs contain three main componentsthe front panel, the block diagram, and the
icon and connector pane. You build the front panel with controls and indicators,
which are the interactive input and output terminals of the VI, respectively.
Controls are knobs, push buttons, dials, and other input devices. Indicators are
graphs, LEDs, and other displays. Controls simulate instrument input devices
and supply data to the block diagram of the VI. Indicators simulate instrument
output devices and display data the block diagram acquires or generates. Use
the Controls palette to place controls and indicators on the front panel. The
Controls palette is available only on the front panel. Select WindowShow
Controls Palette or right-click the front panel workspace to display the Controls
palette.
The two most commonly used numeric objects are the digital control and the
digital indicator. Use Boolean controls and indicators to enter and display
Boolean (TRUE or FALSE) values. Boolean objects simulate switches, push
buttons, and LEDs. The most common Boolean objects are the vertical toggle
switch and the round LED.
Procedure:
Front Panel
Type deg C in the label text box and click the Enter button on the toolbar or
click anywhere on the front panel, to complete the new label.
13
Note: If you click outside the text box without entering text, the label defaults to
Thermometer. To show the label again, right-click the control and select Visible
ItemsLabel from the shortcut menu.
Right-click the deg C thermometer and select Change to Control from the
shortcut menu.
Now that you have a thermometer control for the Celsius temperature, you
need an indicator to display the Fahrenheit value.
Label this Thermometer deg F as you did in Step 3, and make the Digital
Display visible as you did in Step 5.
To change the scale of the deg F thermometer, use the Labeling tool or the
Operating tool to highlight the topmost value of the scale and type 212, which
is the Fahrenheit equivalent of 100 degrees Celsius, the highest visible value
on the deg C Thermometer.
(Optional) You can rearrange and resize the objects on the front panel. Use
the Positioning tool to select objects and move them. To resize an object, use
the Positioning tool to drag a corner of the object until it is the size you want,
and release the mouse button.
14
Block Diagram
Notice the objects on the block diagram. These objects are terminal that
correspond to the thermometer control and indicator you placed on the front
panel.
Notice when you hold the function close to the terminal, LabVIEW
automatically draws a wire to one of the terminals on the multiply function.
When LabVIEW draws a wire between the function and the deg C terminal,
click the mouse button to place the function on the block diagram. Notice the
deg C terminal is wired to the Multiply function.
15
(Optional) If you placed the Multiply function without a wire connection to the
deg C terminal, use the Wiring tool to wire them together by completing the
following steps.
You need to multiply the deg C value by 1.8. Right-click the unwired input
terminal on the Multiply function and select CreateConstant. LabVIEW
creates a numeric constant value and wires it to the input terminal, with the
numeric value highlighted for you to enter a value. Type 1.8 and click the
Enter button, or click anywhere on the block diagram.
You need to add 32 to complete the calculation. Select an Add function from
the FunctionsNumeric palette and drag it to the block diagram. Before you
click the mouse to place the Add function on the block diagram, drag the
function just to the right of the output terminal of the Multiply function.
When a wire that connects the output terminal of the Multiply function and one
of the input terminals of the Add function appears, click the mouse button to
place the function on the block diagram. LabVIEW automatically wires the two
functions together.
If the functions are not wired together, use the Wiring tool as described in
Step 3.
Right-click on the unwired input terminal of the Add function and select
CreateConstant, as you did in Step 4. Type 32 and click the Enter button, or
click anywhere on the block diagram.
Now that you've multiplied the deg C value by 1.8 and added 32, you need to
pass the value to the deg F terminal by completing the following steps.
b. Click the output terminal of the Add function to tack a wire to the terminal.
c. Drag the mouse to the deg F terminal and click the mouse button to wire
the two terminals together.
(Optional) You can rearrange the objects on your block diagram. Use the
Positioning tool to select objects and move them.
16
Your block diagram is now complete, and should look similar to the following
image:
Deg. C
Deg. F
1.80
32.00
Running the VI
On the front panel, use the Operating tool or Labeling tool to enter 37, which
is normal body temperature in Celsius, in the digital display of the deg C
thermometer.
Run the VI by clicking on the Run button. Notice that LabVIEW converts the
Celsius temperature to 98.6 degrees Fahrenheit and displays it on the deg F
thermometer and its digital display. Enter other values in the deg C
thermometer and run the VI.
Questions:
2. What you know about nodes? Explain their similarites in text based
programming languages.
17