0% found this document useful (0 votes)
1 views5 pages

2B-use of subvi

The document outlines the process of finding the square root of a positive number using a sub VI in National Instruments LabVIEW 2012. It explains the hierarchical nature of VIs, the creation of icons and connector panes, and the procedure for implementing a sub VI within a main VI. The result is a functional VI that displays the square root of positive input values while handling negative inputs appropriately.

Uploaded by

vtd687
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views5 pages

2B-use of subvi

The document outlines the process of finding the square root of a positive number using a sub VI in National Instruments LabVIEW 2012. It explains the hierarchical nature of VIs, the creation of icons and connector panes, and the procedure for implementing a sub VI within a main VI. The result is a functional VI that displays the square root of positive input values while handling negative inputs appropriately.

Uploaded by

vtd687
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

EX.NO:2.

B
USE OF SUB VI
22.07.2014

AIM

To find the square root of a positive number using sub VI.

SOFTWARE USED

National Instruments LabVIEW 2012.

THEORY

The power of LabVIEW lies in the hierarchical nature of the VI. After we create a VI,
we can use it on the block diagram of another VI. There is no limit on the number of layers in
the hierarchy. Using modular programming helps us manage changes and debug the block
diagram quickly.

A VI within another VI is called a sub VI. A sub VI corresponds to a subroutine in


text-based programming languages. When we double-click a sub VI, a front panel and block
diagram appear, rather than a dialog box in which we can configure options. The front panel
includes controls and indicators that might look familiar. The block diagram includes wires,
front panel icons, functions, possibly sub VI s, and other LabVIEW objects that also might
look familiar.

Every VI displays an icon in the upper right corner of the front panel and block
diagrams windows. An icon is a graphical representation of a VI. It may contain text, images
or a combination of both. If we use VI as a sub VI the icon identifies the sub VI or the block
diagram of the VI.

CREATING AN ICON

 Right click in the upper right corner at the front panel or block diagram. Select edit
icon from the short cut menu to display the icon editor dialog box.
 Use the tools on the left side of the icon editor dialog box to create the icon design in
the editing area.
CONNECTOR PANE

We also need to build a connector pane to use VI as sub VI. The connector pane is a
set of terminals that corresponds to control and indicator of that VI, similar to the parameter
list of function call in text based programming languages. The connector pane defines inputs
and outputs that you can wire to the VI. So we can use as a sub VI. The connector pane
receives data at input terminals and passes the data to block diagram code to the front panel
controls or receives the results at its output terminals from the front panel indicators.

PLACING SUB VI

After we built VI and creates icon and connect pane we can use the vi in another VI.
The VI use of another VI is called a sub VI. A sub VI mode corresponds to the subroutine
call VI the text based programming language.

PROCEDURE

Open a blank VI

MAIN VI

FRONT PANEL
 Select controls >> numeric control
 Select controls >> numeric indicator

BLOCK DIAGRAM
 Right click multiplier icon >> create >> indicator.
 Select >> functions >> all functions >> select a VI and select sub VI
 Give output of multiplier to sub VI.
 Complete wiring and save VI.

SUB VI

FRONT PANEL

 Select controls >> numeric indicator


 Select controls >> numeric control
BLOCK DIAGRAM

 The vales are given to the numeric control.

 The values are then compared by giving the value to the comparator.

 The compared value is given to the selector which satisfies a true or false condition.

 If the value is true, the function returns the value wired to true else returns to false.

 This value is given to the square root block which is displays it on the numeric
indicator.

SUB VI

FRONT PANEL

BLOCK DIAGRAM
ICON EDITOR
Shows how to edit the icon of subVI

CREATING AN ICON

 Right click the icon in the upper right corner of the front panel or block diagram and
select edit icon from the shortcut menu to display icon editor dialog box.
 Click 16 colors or 256 colors box to select which icon we want to create.
 Use the tools on the left side of the icon editor dialog box to create the icon design in
the editing area.
 Right click on the icon, click connector.
 Select patterns for the connector pane.
 Click the input and first half of the connector pane to wire to the input.
 Click the output and second half of the connector pane to wire to the output.

MAIN VI

FRONT PANEL
BLOCK DIAGRAM

DESCRIPTION

The Sub VI thus created is placed inside the main VI before the VI is run. When the
VI is run, only the positive values (greater than 0) are given as an input. Then the square root
of the given value is displayed on the numeric indicator. This condition works true for values
that are greater than 0 and does not go true if in case the given values are negative i.e., the
values are below 0.

RESULT
Thus a VI is created using sub VI.

You might also like