Team Sub-Groups‎ > ‎Programming‎ > ‎

How to Call a Sub VI or make and use a Custom VI on LabVIEW

posted Jan 4, 2015, 7:51 PM by Rob Owings   [ updated Oct 4, 2015, 12:05 AM by Jeffrey Kangas ]
1. First Make your sub VI.
    one way is to select items on a block diagram and then select the menu item Edit -> Create SubVI
    Another way it to create your own file.  This post will explain how to create your own file.

  A.  Start Labview or if in labview already, select the menu item View -> Getting Started Window
  B.  Select Blank VI

  C.  Add a control and an indicator of the same type.  For this example a Boolean is used.  It is called Button.  The indicator is called Value.  I find it easiest to add the control on the front panel and then go the the block diagram and add the indicator then replace it with the type you like best.


  D. Wire them together
  E. Fix the file icon by double clicking on the picture in the upper right of the block diagram.  That will open the icon editor

I typically use the select tool and remove all but the outer border then put text in the middle. then hit the x in the upper left:

  F.  Now we need to add terminals so you can send data in and get data out of the VI. Go to the Front panel.
    1.  Select a terminal on the left side for input.  It will turn black, then select the button control and the terminal should turn the same color as the control in the block diagram indicating its type
    2.  Select a terminal on the right side for output.  It will turn black, then select the button value indicator and it will turn the same color as the indicator on the block diagram:


    3.  All the empty terminals are unneeded, so you can select a different pattern by right clicking on the terminal and selecting Patterns -> and then the pattern that is desired.  Since this test VI only has one input and one output, a two terminal pattern was chosen.

2.  Incorporate the VI into another VI.  To demonstrate another VI was created and a Control and Indicator were added:

  A. Go to the block diagram

  B.  Right click and choose "select VI" from the menu

C.  Choose the name of the VI you created from the file dialog box.  Once that is done it should show in the block diagram as the icon that you labelled previously.  
D.  Wire the new control and indicator to the VI as shown below

E.  You can also view the terminals by clicking on the vi icon and selecting the top menu item "Visible Items" and then selecting "terminals" on the right extended menu. to show you the terminal pattern you selected previously.

Good luck making and using your own custom VI's