Summary: In this section, you will learn about block diagrams.
After you build the front panel, you add code using graphical representations of functions to control the front panel objects. The block diagram contains this graphical source code. Front panel objects appear as terminals, on the block diagram. Block diagram objects include terminals, subVIs, functions, constants, structures, and wires, which transfer data among other block diagram objects.
The VI in Figure 1 shows several primary block diagram objects-nodes, terminals, and wires.
![]() |
The Functions palette is available only on the
block diagram. The Functions palette contains
the VIs and functions you use to build the block diagram. Select
Window>>Show Functions Palette or right-click
the block diagram workspace to display the
Functions palette. Tack down the Functions
palette by clicking the thumbtack on the top left corner of
the palette. By default, the Functions palette
starts in the Express view.
LabVIEW uses colored icons to distinguish between Express VIs, VIs, and functions on the block diagram. By default, icons for Express VIs appear on the block diagram as expandable nodes with icons surrounded by a blue field. Icons for VIs have white backgrounds, and icons for functions have pale yellow backgrounds.
By default, most functions and VIs on the block diagram appear as icons that are not expandable, unlike Express VIs.
Use Express VIs for common measurement tasks. Express VIs are nodes that require minimal wiring because you configure them with dialog boxes. You can save the configuration of an Express VI as a subVI. Refer to Building the Block Diagram, of the LabVIEW User Manual for more information about creating subVIs from Express VIs.
When you place a VI on the block diagram, LabVIEW considers the VI to be a subVI. When you double-click a subVI, its front panel and block diagram appear, rather than a dialog box in which you can configure options. The front panel includes controls and indicators. The block diagram includes wires, front panel icons, functions, possibly subVIs, and other LabVIEW objects.
The upper right corner of the front panel and block diagram displays the icon for the VI. This is the icon that appears when you place the VI on the block diagram.
You can create a VI to use as a subVI. Refer to Modular Programming for more information about creating VIs and configuring them as subVIs.
Functions are the fundamental operating elements of LabVIEW. Functions do not have front panels or block diagrams but do have connector panes. Double-clicking a function only selects the function.
Nodes are objects on the block diagram that have inputs and/or
outputs and perform operations when a VI runs. They are
analogous to statements, operators, functions, and subroutines
in text-based programming languages. Nodes can be functions,
subVIs, or structures. Structures are process control
elements, such as Case structures, For
Loops, or While Loops. The
Add and Subtract functions in Figure 1 are function nodes.
You can display VIs and Express VIs as icons or as
expandable nodes. Expandable nodes appear as icons
surrounded by a colored field. SubVIs appear with a yellow
field, and Express VIs appear with a blue field. Use icons,
such as the Basic Function Generator VI icon if
you want to conserve space on the block diagram. Use
expandable nodes, such as the Basic Function
Generator VI expandable node to make wiring easier
and to aid in documenting block diagrams. By default, subVIs
appear as icons on the block diagram, and Express VIs appear
as expandable nodes.
To display a subVI or Express VI as an expandable node,
right-click the subVI or Express VI and select View As
Icon from the shortcut menu to remove the checkmark.
You can resize the expandable node to make wiring even easier, but it also takes a large amount of space on the block diagram. Complete the following steps to resize a node on the block diagram.
Positioning tool over the
node. Resizing handles appear at the top and bottom of the
node.
To cancel a resizing operation, drag the node border past the block diagram window before you release the mouse button.
Figure 2 shows the Basic Function
Generator VI as a resized expandable node.
![]() |
Front panel objects
appear as terminals on the block diagram. The terminals
represent the data type of the control or indicator. You can
configure front panel controls or indicators to appear as
icon or data type terminals on the block diagram. By
default, front panel objects appear as icon terminals. For
example, a knob icon terminal, shown at left, represents a
knob on the front panel. The DBL at the bottom of the
terminal represents a data type of double-precision,
floating-point numeric. To display a terminal as a data type
on the block diagram, right-click the terminal and select
View As Icon from the shortcut menu to remove
the checkmark. A DBL data type terminal, shown above at
left, represents a double-precision, floating-point numeric
control or indicator.
Terminals are entry and exit ports that exchange information
between the front panel and block diagram. Terminals are
analogous to parameters and constants in text-based
programming languages. Types of terminals include control or
indicator terminals and node terminals. Control and
indicator terminals belong to front panel controls and
indicators. Data you enter into the front panel controls
(Add and Subtract functions. When
the Add and Subtract functions
complete their internal calculations, they produce new data
values. The data flow to the indicator terminals, where they
exit the block diagram, reenter the front panel, and appear
in front panel indicators (
Add and
Subtract functions, shown in Media 5, have three node terminals. To display the
terminals of the function on the block diagram, right-click
the function node and select Visible
Items>>Terminals from the shortcut menu.
You transfer data among block diagram objects through
wires. Wires are analogous to variables in text-based
programming languages. In Figure 1, wires connect
the control and indicator terminals to the Add
and Subtract functions. Each wire has a single
data source, but you can wire it to many VIs and functions
that read the data. Wires are different colors, styles, and
thicknesses, depending on their data types. A broken wire
appears as a dashed black line with a red X in the
middle. The examples in Table 1 are the most
common wire types.
| Wire Type | Scalar | 1D Array | 2D Array | Color |
|---|---|---|---|---|
| Numeric |
|
|
|
Orange (floating-point), Blue (integer) |
| Boolean |
|
|
|
Green |
| String |
|
|
|
Pink |
In LabVIEW, you use wires to connect multiple terminals together to pass data in a VI. The wires must be connected to inputs and outputs that are compatible with the data that is transferred with the wire. For example, you cannot wire an array output to a numeric input. In addition the direction of the wires must be correct. The wires must be connected to only one input and at least one output. For example, you cannot wire two indicators together. The components that determine wiring compatibility include the data type of the control and/or indicator and the data type of the terminal.
Data types indicate what objects, inputs, and outputs you can wire together. For example, a switch has a green border so you can wire a switch to any input with a green label on an Express VI. A knob has an orange border so you can wire a knob to any input with an orange label. However, you cannot wire an orange knob to an input with a green label. Notice the wires are the same color as the terminal.
The
dynamic data type stores the information generated or
acquired by an Express VI. The dynamic data type appears
as a dark blue terminal, shown at left. Most Express VIs
accept and/or return the dynamic data type. You can wire
the dynamic data type to any indicator or input that
accepts numeric, waveform, or Boolean data. Wire the
dynamic data type to an indicator that can best present
the data. Indicators include a graph, chart, or numeric
indicator.
Most other VIs and functions in LabVIEW do not accept the dynamic data type. To use a built-in VI or function to analyze or process the data the dynamic data type includes, you must convert the dynamic data type.
Use the
Convert from Dynamic Data Express VI, shown at
left, to convert the dynamic data type to numeric,
Boolean, waveform, and array data types for use with other
VIs and functions. When you place the Convert from
Dynamic Data Express VI on the block diagram, the
Configure Convert from Dynamic Data dialog
box appears. The Configure Convert from Dynamic
Data dialog box displays options that let you
specify how you want to format the data that the
Convert from Dynamic Data Express VI returns.
When you wire a dynamic data type to an array indicator,
LabVIEW automatically places the Convert from
Dynamic Data Express VI on the block
diagram. Double-click the Convert from Dynamic
Data Express VI to open the Configure Convert
from Dynamic Data dialog box to control how the
data appears in the array.
Use the Convert to Dynamic Data Express VI to
convert numeric, Boolean, waveform, and array data types
to the dynamic data type for use with Express VIs. When
you place the Convert to Dynamic Data Express
VI on the block diagram, the Configure Convert to
Dynamic Data dialog box appears. Use this dialog
box to select the kind of data to convert to the dynamic
data type.
LabVIEW automatically wires objects as you place them on the block diagram. You also can automatically wire objects already on the block diagram. LabVIEW connects the terminals that best match and leaves terminals that do not match unconnected.
As you move a selected object close to other objects on the block diagram, LabVIEW draws temporary wires to show you valid connections. When you release the mouse button to place the object on the block diagram, LabVIEW automatically connects the wires.
Toggle automatic wiring by pressing the spacebar while you
move an object using the Positioning
tool. You can adjust the automatic wiring settings by
selecting Tools>>Options and selecting
Block Diagram from the top pull-down menu.
When you pass the Wiring tool over a
terminal, a tip strip appears with the name of the
terminal. In addition, the terminal blinks in the
Context Help window and on the icon to help
you verify that you are wiring to the correct terminal.
"A full introductory course on programming with LabVIEW."