After you create the front panel window, you add code to the LabVIEW block diagram using graphical representations of functions to complete calculations and control the front panel objects. To bring up the block diagram, select Window»Show Block Diagram from the menu bar. Additionally, you can toggle between the block diagram and the front panel by pressing <Ctrl-E>.
Block diagram objects include terminals, subVIs, functions, constants, structures, and wires, which transfer data among other block diagram objects.
- Terminals
Front panel objects appear as terminals on the block diagram. Terminals on the block diagram reflect the changes made to their corresponding front panel objects and vice versa.
Terminals are entry and exit ports that exchange information between the front panel and block diagram. They are analogous to parameters and constants in text-based programming languages.
- Constants
In addition to controls and indicators, you can have constants on the block diagram for static values needed in your code. You can have constants for any data type.
Consider an algorithm for computing the area of a triangle. You might have the following front panel and corresponding block diagram.
(1) Controls | (2) Indicator | (3) Constant
The constant Triangular Multiplier does not appear on the front panel window. It simply passes the value of .5 into the multiply function.
Notice that the Base(cm) and Height(cm) block diagram terminals look different from the Area(cm^2) terminal.
There are two distinguishing characteristics between a control and an indicator on the block diagram. The first is an arrow on the terminal that indicates the direction of data flow. The controls have arrows showing the data leaving the terminal, whereas the indicator has an arrow showing the data entering the terminal. The second distinguishing characteristic is the border around the terminal. Controls have a thick border and indicators have a thin border.
- Block Diagram Nodes
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.
- Functions
To place objects on the block diagram, simply drag and drop them from the Functions palette. The Functions palette automatically appears when you right-click anywhere on the block diagram workspace. It contains functions, constants, structures, and some subVIs.
The Search button on the Functions palette opens a search dialog box that you can use to search for functions by name. It takes a few moments to launch.
After you see the function you want, double-click on it and LabVIEW jumps to the place on the Functions palette where you can find that function.
Functions are the fundamental operating elements of LabVIEW. Functions do not have front panel windows or block diagram windows, but they do have input and output terminals for passing data in and out similarly to controls and indicators. You can tell if a block diagram object is a function by the pale-yellow background on its icon. The Functions palette has functions arranged in groups based on the type of function they perform. For example, you can look in the Numeric subpalette for functions that perform numeric operations.