Block Diagram in LabVIEW
Front panel objects appear as terminals on the block diagram. Figure 2.12 shows the front panel where two numeric values A and B need to be added and subtracted, and the block diagram for the corresponding front panel. 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 (A and B in the figure) enter the block diagram through the control terminals. The data then enter the Add and Subtract functions. When the Add and Subtract functions complete their calculations, they produce new data values. The data values flow to the indicator terminals, where they update the front panel indicators.
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 numeric icon terminal, shown in Figure 2.13, represents a numeric control on the front panel. A DBL terminal represents a double-precision, floating-point numeric control. 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.
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 the previous figure are function nodes.
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. A function has a pale yellow background on its icon.
SubVIs are VIs that you build to use inside of another VI or that you access on the Functions palette. Any VI has the potential to be used as a subVI. When you double click a subVI on the block diagram, its front panel and block diagram appear. 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 a block diagram as a subVI. SubVIs also can be Express VIs. Express VIs are nodes that require minimal wiring because you configure them with dialog boxes. Use Express VIs for common measurement tasks. You can save the configuration of an Express VI as a subVI. Refer to the Express VIs topic of the LabVIEW Help for more information about creating a subVI from an Express VI configuration.
Express VIs and VIs
Express Vis are interactive VIs with configurable dialog page but Standard VIs are modularized VIs customized by wiring. 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.
You can transfer data among block diagram objects through wires. 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 as shown in Table 2.5. A broken wire appears as a dashed black line with a red X in the middle, as shown at left. Broken wires occur for a variety of reasons, such as when you try to wire two objects with incompatible data types. You must connect the wires to inputs and outputs that are compatible with the data that is transferred with the wire. You cannot wire an array output to a numeric input. In addition, the direction of the wires must be correct. You must connect the wires to only one input and at least one output. Also you cannot wire two indicators together. The components that determine wiring compatibility include the data type of the control and/or the indicator and the data type of the terminal. Press <Ctrl>-B to delete all broken wires or right-click and select Clean Up Wire to reroute the wire.
LabVIEW automatically wires objects as you place them on the block diagram. LabVIEW connects the terminals that best match and leave 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.