Suspend execution of a subVI to edit values of controls and indicators, to control the number of times the subVI runs before returning to the caller, or to go back to the beginning of the execution of the subVI. You can cause all calls to a subVI to start with execution suspended, or you can suspend a specific call to a subVI.
Complete the following steps to suspend all calls to a subVI.
- Open the subVI.
- Select Operate»Suspend when Called.
The subVI automatically suspends when another VI calls it. If you select this menu item when single-stepping, the subVI does not suspend immediately. The subVI suspends when it is called.
When you select View»VI Hierarchy, a VI configured to suspend when called appears with a green exclamation point (!). A suspended VI appears with a red exclamation point.
Complete the following steps to suspend execution at a specific subVI call.
- Right-click the subVI node and select SubVI Node Setup from the shortcut menu. The SubVI Node Setup dialog box appears.
- Place a checkmark in the Suspend when called checkbox and click the OK button.
You also can use the Suspend On Call property to suspend a VI programmatically.
After you suspend execution of a subVI, you can perform the following tasks:
- Click the Return to Caller button at the top left of the subVI front panel to return to the caller VI. The Return to Caller button appears when a suspended subVI is not running. Notice that you can return to a caller VI without running the current VI. If you want to run the current VI, click the Run button before you return to the caller.
- Run the subVI as many times as you want before returning to the caller VI. Click the Run button or select Operate»Run. To go back to the beginning of the execution of the subVI when the subVI is running, click the Skip to Beginning button at the top left of the subVI block diagram.
- Change the control or indicator values if you want to return different values to the caller VI. You can set values of indicators only when a suspended VI is not running. Click the Return to Caller button at the top left of the subVI front panel to send the indicator values of the subVI to the caller VI.