Saturday, May 16, 2009

SubVIs, the Icon, and the Connector in LabVIEW

A subVI simply refers to a VI that is going to be called by another VI. Any VI can be configured to function as a subVI. For example, let's say you create a VI called Mean.vi that calculates the mean value of an array. You can always run Mean.vi from its front panel (by pressing the run button on the toolbar), but you can also configure Mean.vi so that other VIs can call it as a function on their block diagram (they call Mean.vi as a subVI).

When your VI operates as a subVI, its controls and indicators receive data from and return data to the VI that calls it. A VI's icon represents it as a subVI in the block diagram of another VI. An icon can include a pictorial representation or a small textual description of the VI, or a combination of both.


The VI's connector functions much like the parameter list of a C or Pascal function call; the connector terminals act like little graphical parameters to pass data to and from the subVl. Each terminal corresponds to its very own control or indicator on the front panel. During the subVI call, the input parameter terminals are copied to the connected controls, and the subVI executes. At completion, the indicator values are copied to the output parameter terminals.

Figure 14. An icon and its underlying connector

Every VI has a default icon, which is displayed in the icon pane in the upper-right corner of the panel and diagram windows. The default icon is depicted in Figure 15.

Figure 15. The VI icon pane in the 
upper-right corner of a VI front panel

A VI's connector is hidden under the icon; access it by choosing Show Connector from the front panel icon pane pop-up menu (we'll talk more about pop-up menus later). When you show the connector for the first time, LabVIEW helpfully suggests a connector pattern that has twelve terminals (six on the left for inputs and six on the right for outputs). The default connector pane is depicted in Figure 16. You can select a different pattern if you desire, and you can assign up to 28 terminals before you run out of real estate on the connector.

Figure 16. The VI connector pane in 
the upper-right corner of a VI front panel

No comments:

Post a Comment