LabVIEW offers many different tools for debugging applications. One such tool, which is not commonly used, is the Suspend When Called
option for subVIs. This setting can be enabled in multiple ways. You can either right-click an instance of a subVI and select SubVI Node Setup
and enable it from this window:
You can also select Operate>>Suspend when called
Enabling this option suspends a subVI when called and waits for user interaction. The subVI's Front Panel will open and allow the user to run the VI repeatedly to test different input values. For instance, supposed we build a VI, X^Y.vi
, to calculate x^y
for input values x
. We use this as a subVI and enable the Suspend when called option as described above. When our application is run, the Front Panel of X^Y.vi
shows as follows:
The Run arrow,
, is used to run the VI using the displayed inputs. However, you can also change the inputs of the VI, while in this mode, and run it to see the corresponding output. Then, after we have finished testing various inputs, press the Return to Sender button,
, to return to the main VI. At this point, the last output values you calculated will be passed back to the main VI. Therefore, if while is Suspend mode, we change the VI's inputs to x = 2 and y = 3, then x^y = 8 and when execution returns to the main VI, it will output 8.
Suspend when called
is a very powerful tool for debugging. As you become a more advanced LabVIEW developer, take advantage of this utility when developing your applications.