Académique Documents
Professionnel Documents
Culture Documents
GOALS
Enter the LabVIEW environment
See the graphical language at work
Build a digital-to-analog converter
Take the LabVIEW challenge: Vector Calculator
KEY TERMS
LabVIEW workspace Analog Amplifier
LabVIEW Tools, Controls, and Digital Amplifier
Functions Digital-to-Analog Converter
LabVIEW Palettes everywhere
LabVIEW
Environment
1
1
2 Sensors, Transducers and LabVIEW
Default Title
Run Continuously
Abort Default Font & Size
Run
Workspace Icon
Pane
Workspace
Boolean
(Sub-menu)
Select a Control...
6 Sensors, Transducers and LabVIEW
Workspace
and presto, the gauge appears. The black box indicates that a
label is requested. You can now type a name for this object.
When the cursor is clicked in the workspace, the label is set. It
8 Sensors, Transducers and LabVIEW
The controls palette is only active and visible when the front
panel is the active window. When the diagram panel is selected,
a new Functions palette appears. If it is not visible, it can be se-
lected from the Windows>Show Functions palette. Like the
control palette, it contains a wealth of LabVIEW functions con-
veniently divided into areas of common operations such a nu-
merics, Booleans, strings, arrays, clusters, and so on.
Numeric
Array
Structures
String Boolean
Cluster
Comparison
File I/O
Time & Dialog
Communications
Advanced
Analysis Select a VI
Instrument Drivers
Tutorial
User Libraries
1 | LabVIEW Environment 9
A m plif ie r
Diagram Panel
1 | LabVIEW Environment 11
The input, gain, and meter values are all numeric values and
are indicated by an orange box with the letters DBL inside the
terminal box. DBL stands for double precision floating point
variable. Note the different shaped boxes for input and output.
Inputs have heavy outlines around the terminal, while outputs
have a single line around the terminal. The ON/OFF switch is a
different data type, a Boolean. It only has two possible states
ON or TRUE and OFF or FALSE. Its input terminal is green in
color, heavy outlined with the letters TF inside the box.
Analog Amplifier
To convert these inputs and outputs into an instrument, the in-
puts and outputs must be connected to the mathematical func-
tions that simulate the required operation. In this instrument,
the relationship is Output = Input Gain. In LabVIEW, graphi-
cal symbols or icons are used to represent mathematical and
other functions. One wires up the inputs to the input side of the
function and the output to the display. To do this, we will use
the Positioning tool to move the input and output terminals
into a more natural programming arrangement.
Amplifier.vi Diagram
The window behind the front panel is often called the block di-
agram, since the program design resembles an electronic
schematic diagram. Here is where we have built the circuit to
simulate the amplifier. Note that the inputs are usually on the
12 Sensors, Transducers and LabVIEW
left and the outputs on the right. The wiring tool is used to con-
nect input/output terminals to the functions. Just click on the
input/output, drag to the appropriate location, and click.
Presto, in a data path is made.
What about that power switch? In LabVIEW, programs are
often placed into a while loop, shown above as the heavy gray
box. It has a control terminal [ ] and even an index [i]. The
[while . . . loop] structure executes everything inside the box,
then reads the control terminal [ ]. If the Boolean input is true,
the loop repeats and executes all functions inside the box. If the
Boolean input is false, the process stops. In this example, the
while . . . loop simulates the ON/OFF power switch on the front
panel.
Digital Amplifier
In our second example, we will look at a digital amplifier,
whose input is only amplified when a switch is thrown. The bit
switch is depicted on the front panel as a vertical throw switch.
It outputs a Boolean data type, true (ON) or false (OFF). These
two states are converted into a numeric (1) or (0) respectively by
a Boolean-to-numeric transformation function. A bit indicator
(LED display) displays the state of the switch when the program
is run. The output of the switch (0) or (1) is multiplied by a con-
stant weighting factor and the resultant value displayed in the
output box labeled Value.
1 | LabVIEW Environment 13
For example, if the weight is 64, then the output can only
have two values: 0 if switch is off and 64 if the switch is on. In
this example, there are two inputs (Bit Switch and Weight) and
two outputs (Bit Indicator and Value). These four input/output
links show up on the block diagram as four terminal boxes.
Note the special icon [?0:1] that converts the Boolean output
of the switch into a numeric value. This is essential, since the
multiply function can only operate on numerics.
When a second binary switch is added in parallel with the
first one, the outputs of the two switches are added together to
form a sum.
14 Sensors, Transducers and LabVIEW
The first switch labeled [Bit 1] has a weight of 2 and the sec-
ond switch [Bit 0] has a weight of 1. There are four possible out-
put values (0, 1, 2, or 3). On the block diagram, the program is
just a little more complicated.