From The Blackfin Handy Board

CourseMaterials: CreatingASubVI

Creating a SubVI What is a SubVI? A SubVI is any VI used within another VI. This is simliar to C, where functions all operate within either other functions or the Main function.

Where to Start First we create a VI. For this example we will create a simple Wait VI. This VI will create a delay before the next VI is triggered. Open a new blank VI. On the Front Panel place a Numeric control from the Numeric category of the VI Library using a right click on an empty space of the Front Panel. Also place an Error In 3D and an Error Out 3D from the Array and Cluster category of the VI library.

Switch to the Block Diagram and create a wire from the Error In to the Error Out. Now place a Wait VI onto the block diagram and connect its input to the Numeric control. Right click the Numeric Control and select Representation>>Unsigned Long. This means that the control will only accept unsigned integers.

Connectors You now have what can be considered a working VI. However it is not ready to be used as a SubVI. Because if you were to place it onto another VI's Block Diagram it would have no connections for input or output. On both the Front Panel and the Block Diagram windows there is an icon in the top right corner. In order to create connections for the VI you must right click the icon on the Front Panel and select 'Show Connector.' If you right click the icon on the Block Diagram the available commands will be different.

Once you have given the show connector command the icon should change into a square segmented into three parts. Two parts should be on the left with one large part on the right. The segments on the left represent the possible inputs and the segment on the right represent the possible output. These segments must be associated to the appropriate input/output. To do this select the top left segment and then select the Numeric control. The segment should now change to the color blue to signify that it is an integer input. Now select the lower left segment and then select the Error In. The segment should now change to pink. The final segment should be associated with the Error Out indicator and should also be represented by pink.

Save your VI and rejoyce. You have made your first SubVI. You can now use this VI within other VI's. Just be sure to remember to wire the Error connectors so that LabVIEW does not get confused.

Retrieved from
Page last modified on June 27, 2006, at 09:41 PM