The posts talks about how to create and use a sub vi.
Create a Sub VI
The first step in creating a Sub VI is to modify it's icon so that it can be recognized when it is used in an upper-level VI. Every VI has a default icon in the upper-right corner of both the Front Panel and the Block Diagram.
![]() |
Default VI Icon in VI Window |
In order to customize the icon, pop-up on it's >Edit Icon.
![]() |
Click on Edit Icon |
The Icon Editor window appears(as shown below on next page):
The largest area is where the default icon. This is where the icon is edited using the Editing Tools (Explained in detail below). The Menu Bar contains standard editing options like Undo, Redo, Cut, Copy, Paste, etc. By Default the Display Mode is set to 256 Colors which is most commonly used (using a monochrome display).
![]() |
Sample Edit Icon Window |
An example of an edited icon is below:
![]() |
Example of Edited Icon |
The next step in creating a Sub VI is to assign the icon connectors to the appropriate Front Panel Controls and Indicators. This will allow Controls and Indicators in the Upper-level VI to wire to the Sub VI. In the Front Panel, pop-up on the VI Icon > Show Connector:
![]() |
Click on Show connector on Default VI Icon and Click Show Connector |
The Icon will change to show all of its connectors. In this case, our example looks like this:
![]() |
This is how the default icon will look when we click on show connector |
It has four connectors on the left and one on the right. The four connectors on the left will be the data-input wire hot spots for the four required Front Panel Controls. The connector on the left will be the data-output wire hot spot for the Front Panel Indicator. The connectors to the appropriate Controls and Indicators are assigned. This is done using the Connect Wire Tool on the Tools Palette. After the Connect Wire Tool is selected, click on an icon connector and then click on it's respective Control or Indicator on the Front Panel. The icon connector should become dark. Repeat this process until all of the connectors have been assigned their respective Controls or Indicators. Be careful of the order of your selection. It will determine how the Sub VI is wired in the upper-level VI. When you are done, all connectors on the icon representation should be dark.
![]() |
Click on the connector of the icon and then click on the appropriate Input or output to make connections |
Using a Sub VI in an upper-level VI .for example to employ the Slope Function VI in another VI called Slope_Function_Sub.vi After the upper-level VI is created and added all of the necessary Controls and Indicators, add the Sub VI to the Block Diagram by popping-up > Functions > Select A VI:
![]() |
Goto Select a VI and Then Choose Your Saved VI to import it into a higher VI |
After Selecting do the appropriate connection by providing appropriate input and outputs to your sub VI.
![]() |
Import your Own Sub VI and MAke the Appropriate Connections |
No comments:
Post a Comment