Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
This exercise will walk you through creating subVIs and modularity. It will show
you how to create the icon and connector panes for the subVI.
Goal
Create the icon and connector pane for a VI so that you can use the VI as a
subVI.
Scenario
You have created a VI that determines a warning string based on the inputs
given. Create an icon and a connector pane so that you can use this VI as a
subVI.
Design
Use the standard connector pane to assure room for future expansion. Add
error clusters to the VI so that the code runs if there is no error, but does not
run if there is an error.
Implementation
❑ Using the wiring tool, click the upper-left terminal of the connector pane.
❑ Click the corresponding front panel control, Current Temp. Notice that the
connector pane terminal fills in with a color to match the data type of the
control connected to it.
❑ Click the next terminal in the connector pane.
❑ Click the corresponding front panel control, Max Temp.
❑ Continue wiring the connector pane until all controls and indicators are
wired, and the Context Help window matches that shown in the previous
figure.
5. Create an icon.
❑ Right-click the connector pane and select Edit Icon. The Icon Editor window
opens.
❑ Use the tools in the Icon Editor window to create an icon. Make the icon as
simple or as complex as you want, however, it should be representative of
the function of the VI. The figure below shows a simple example of an icon for
this VI.
❑ Click OK when you are finished to close the Icon Editor window.
Tip: Double-click the selection tool to select the existing graphic. Press the
<Delete> key to delete the graphic. Then, double-click the rectangle tool to
automatically create a border for the icon.
Tip: Double-click the text tool to modify fonts. You can select Small Fonts to
choose fonts smaller than 9 points in size.
6. Right-click the connector pane and select Show Icon from the shortcut menu
to return to Icon view.
7. Save the VI.
8. Switch to the block diagram.
9. Set the VI to execute if no error occurs, and not execute if an error occurs.
❑ Surround the block diagram code with a Case structure as shown in the
figure below. Leave the Warning Text and Warning? indictors outside of the
Case structure.
❑ Wire the error in control to the case selector terminal.
❑ Confirm that the block diagram is in the No Error case. If it is not, switch to
the case containing the code, right-click the Case structure and select Make
this Case No Error from the shortcut menu.
❑ Wire the error cluster through the Case structure to the error out indicator
as shown in the above figure.
❑ Switch to the Error case.
❑ Wire the error cluster through the case to the error out tunnel.
❑ Right-click the Warning? tunnel and select Create»Constant from the
shortcut menu.
❑ Use the Operating tool to change the constant to True.
❑ Right-click the Warning Text tunnel and select Create»Constant from the
shortcut menu.
❑ Enter Error in the constant.
❑ Confirm that you have completed the Error case as shown in the figure
below.
If an error enters the VI, the VI outputs Error in Warning Text, and True in
Warning? and passes the error out of the VI. If an error does not enter the VI,
the VI operates as originally designed.
Test