You are on page 1of 4

Descrizione

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

The subVI contains the following inputs and outputs:
Inputs Outputs
Current Temp Warning Text
Max Temp Warning?
Min Temp -

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

1. Open the Determine Warnings VI located at the bottom of this page.
2. Add an error input cluster and an error output cluster to the VI.
❑ Add an Error In 3D.ctl to the front panel.
❑ Add an Error Out 3D.ctl to the front panel.
3. Select a connector pane pattern for the VI.
❑ Right-click the icon in the upper-right corner of the window and select
Show Connector from the shortcut menu.
❑ Right-click the connector pane in the upper-right corner of the window,
select Patterns,
❑ from the shortcut menu, and choose the pattern shown at left.
4. Connect the inputs and outputs to the connector as shown in the following
figure.

❑ Using the wiring tool, click the upper-left terminal of the connector pane.

You can select Small Fonts to choose fonts smaller than 9 points in size. 5. Press the <Delete> key to delete the graphic. Leave the Warning Text and Warning? indictors outside of the Case structure. ❑ Continue wiring the connector pane until all controls and indicators are wired. and not execute if an error occurs. Save the VI. The figure below shows a simple example of an icon for this VI. Notice that the connector pane terminal fills in with a color to match the data type of the control connected to it. 9. Max Temp. ❑ Click the corresponding front panel control. ❑ Click the corresponding front panel control. ❑ Right-click the connector pane and select Edit Icon. Tip: Double-click the text tool to modify fonts. The Icon Editor window opens. Set the VI to execute if no error occurs. ❑ Click the next terminal in the connector pane. and the Context Help window matches that shown in the previous figure. . 7. however. Switch to the block diagram. ❑ Click OK when you are finished to close the Icon Editor window. ❑ Surround the block diagram code with a Case structure as shown in the figure below. double-click the rectangle tool to automatically create a border for the icon. 6. ❑ Use the tools in the Icon Editor window to create an icon. Current Temp. it should be representative of the function of the VI. 8. Tip: Double-click the selection tool to select the existing graphic. Make the icon as simple or as complex as you want. Create an icon. Then. Right-click the connector pane and select Show Icon from the shortcut menu to return to Icon view.

If an error does not enter the VI. 1. ❑ Wire the error in control to the case selector terminal. Test Use a blank VI to test the subVI. 2. If an error enters the VI. . 10. Save and close the VI. and True in Warning? and passes the error out of the VI. ❑ Enter Error in the constant. ❑ Confirm that the block diagram is in the No Error case. the VI outputs Error in Warning Text. ❑ Use the Operating tool to change the constant to True. If it is not. switch to the case containing the code. ❑ Confirm that you have completed the Error case as shown in the figure below. Open a blank VI. ❑ Wire the error cluster through the Case structure to the error out indicator as shown in the above figure. ❑ Right-click the Warning Text tunnel and select Create»Constant from the shortcut menu. Open the block diagram. right-click the Case structure and select Make this Case No Error from the shortcut menu. ❑ Switch to the Error case. the VI operates as originally designed. ❑ Right-click the Warning? tunnel and select Create»Constant from the shortcut menu. ❑ Wire the error cluster through the case to the error out tunnel.

Switch to the front panel. After you have finished testing. ❑ Right-click the Max Temp input and select Create»Control from the shortcut menu. Place the Determine Warnings subVI on the block diagram of the blank VI by selecting the Select a VI option on the Functions palette and navigating to where you saved the previous VI. 4. ❑ Right-click the Current Temp input and select Create»Control from the shortcut menu. Max Temp. Create controls and indicators for each item in the subVI. 7. ❑ Right-click the Warning? output and select Create»Indicator from the shortcut menu. 6. and Min Temp. close the test VI. You do not need to save the test VI. Run the VI. 8. ❑ Right-click the Warning Text output and select Create»Indicator from the shortcut menu.3. End of Exercise . Enter test values in Current Temp. ❑ Right-click the Min Temp input and select Create»Control from the shortcut menu. 5.