To Create a Connector Pane in Modular Programming
Recommended by 0 users
BUILDING A CONNECTOR PANE
The connector pane is a set of terminals that correspond to the controls and indicators of that VI, similar to the parameter list of a function call in text-based programming languages. The connector pane defines the inputs and outputs you can wire to the VI so that you can use it as a subVI. A connector pane receives data at its input terminals and passes the data to the block diagram code through the front panel controls or receives the results at its output terminals from the front panel indicators.
To define a connector pane, right-click the icon in the upper-right corner of the front panel and select Show Connector from the shortcut menu to display the connector pane. The connector pane appears in place of the icon. When you view the connector pane for the first time, you see a default connector pattern. You can select an appropriate pattern by right-clicking the connector pane and selecting Patterns from the shortcut menu as shown in Figure 3.8. After you select a connector pane pattern, you can customize it to suit the VI by adding, removing or rotating the terminals.
To add a terminal to the pattern, place the cursor where you want to add the terminal, right-click, and select Add Terminal from the shortcut menu. To remove an existing terminal from the pattern, right-click the terminal and select Remove Terminal from the shortcut menu. To change the spatial arrangement of the connector pane patterns, rightclick the connector pane and select Flip Horizontal, Flip Vertical, or Rotate 90 Degrees from the shortcut menu. Assign a front panel control or indicator to each of the connector pane terminals. If you placed the VI as a subVI on another block diagram, you must relink the subVI to the VI whose connector pane you changed by right-clicking the subVI and selecting Relink To SubVI from the shortcut menu. Otherwise, the VI containing the subVI is broken and will not run.
Each rectangle on the connector pane represents a terminal. Use the rectangles to assign inputs and outputs. The default connector pane pattern is 4 2 2 4. If you anticipate changes to the VI that would require a new input or output, keep the default connector pane pattern to leave extra terminals unassigned. You can assign up to 28 terminals to a connector pane. If our front panel contains more than 28 controls and indicators that you want to use programmatically, group some of them into a cluster and assign the cluster to a terminal on the connector pane. Assigning more than 16 terminals to a VI can reduce readability and usability.
Assigning Terminals to Controls and Indicators
After you select a pattern to use for the connector pane, you must assign a front panel control or indicator to each of the connector pane terminals. To link controls and indicators to the connector pane, place inputs on the left and outputs on the right to prevent complicated or confusing wiring patterns.
Complete the following steps to assign terminals to controls and indicators in a connector pane.
Step 1: Ensure that you have selected a pattern sufficient for the number of controls and indicators you want to assign to the connector pane.
Step 2: Right-click the icon in the upper-right corner of the front panel and select Show Connector from the shortcut menu to display the connector pane. The connector pane appears in place of the icon.
Step 3: Click a terminal of the connector pane. The tool automatically changes to the wiring tool and the terminal turns black.
Step 4: Click the front panel control or indicator you want to assign to the terminal. A marquee highlights the object as shown in Figure 3.9.
Step 5: Click an open space of the front panel. The marquee disappears, and the terminal changes to the data type color of the control to indicate that you connected the terminal. If the connector pane terminal turns white, a connection was not made. Repeat steps 1 through 3 until the connector pane terminal changes to the proper data type color.
Step 6: Repeat steps 3 through 5 for each control and indicator you want to assign to a terminal. If you need to change the control or indicator assigned to a terminal, you must first delete the connection and repeat steps 3 through 5 to assign another control or indicator to the terminal.
Step 7: If necessary, confirm each terminal connection. You can specify which terminals are required, recommended and optional. You can connect only one control or indicator to a terminal.
Confirming Terminal Connections
To confirm which control or indicator is assigned to a connector pane terminal, click the terminal in the connector pane. A marquee highlights the assigned object. You also can use the wiring tool to click the control or indicator. The color of the assigned terminal in the connector pane darkens.
Deleting Terminal Connections
You can delete connections between terminals and the corresponding controls or indicators individually or all at once. Complete the following steps to delete a terminal connection.
Step 1: Right-click the terminal you want to disconnect on the connector pane and select Disconnect This Terminal from the shortcut menu.
Step 2: The terminal turns white to indicate that the connection no longer exists.
Step 3: Disconnect This Terminal is different from Remove Terminal, in that Disconnect this Terminal does not remove the terminal from the pattern.
Step 4: To delete all connections on the connector pane, right-click anywhere on the connector pane and select Disconnect All Terminals from the shortcut menu.
Setting Required, Recommended, and Optional Inputs and Outputs
You can designate which inputs and outputs are required, recommended, and optional to prevent users from forgetting to wire subVI terminals. Right-click a terminal in the connector pane and select This Connection Is from the shortcut menu. A checkmark indicates the terminal setting. Select Required, Recommended or Optional. For terminal inputs, Required means that the block diagram on which you placed the subVI will be broken if you do not wire the required inputs. Required is not available for terminal outputs. For terminal inputs and outputs, Recommended or Optional means that the block diagram on which you placed the subVI can execute if you do not wire the recommended or optional terminals. If you do not wire the terminals, the VI does not generate any warnings. Complete the following steps to set a terminal to required, recommended, or optional.
Step 1: Right-click a terminal in the connector pane and select This Connection Is from the shortcut menu.
Step 2: A checkmark indicates the terminal setting. Select Required, Recommended or Optional.
Inputs and outputs of VIs in vi.lib are already marked as Required, Recommended or Optional. LabVIEW sets inputs and outputs of VIs you create to Recommended by default. Set a terminal setting to Required only if the VI must have the input or output to run properly. In the Context Help window, the labels of required terminals appear bold, recommended terminals appear as plain text, and optional terminals appear dimmed. The labels of optional terminals do not appear if you click the Hide Optional Terminals and Full Path button in the Context Help window.