VI High 11: How to Use “Suspend When Called” in SubVI Node Setup in LabVIEW
You may shake your head in disbelief as we explore an often overlooked feature in LabVIEW: the “Suspend when called” option in the SubVI Node Setup menu. Your life is about to get better.
For more on learning LabVIEW, check out the Sixclear Lucid LabVIEW Fundamentals Training (formerly Sixclear LabVIEW Fundamentals) course offered by Sixclear: sixclear.com.
Experience Level: Basic to Advanced
“Recently, a few of us Sixclearers attended a LabVIEW Architects Forum here in sometimes too sunny Austin, TX. The presenters briefly discussed the Suspend When Called option in SubVI Node Setup. Jaws dropped as, almost to a person, we realized that we hadn’t been fully utilitizing this important feature. Let’s explore.
This very simple VI takes 2 numbers, Numeric and Numeric 2, and multiplies them in this subVI featuring an iconically clever play on words. We’re just multiplying them together, and then checks to see if that product passes a threshold value of 10. To check this, I’ll put a 2 and a 3 in the front panel numerics, run the VI, we have an output of 6, which does not pass the threshold value of 10 and so our LED stays off.
If I right click on the subVI I bring up the SubVI Node Setup. I’ll click on Suspend When Called. Ok. Now when I run the VI the front panel of the subVI comes up and allows me to interact. I can, for instance, change the value of the incoming data, run the subVI again. So now I can essentially supply whatever data I want to the subVI, regardless of what my calling VI actually supplied. So I’ll click on Return to Caller and the VI stops.
Additionally, and I hope you’re sitting down, if I run this again I can place a new value in the output of this subVI, regardless of what the subVI actually did. So, for instance, right now we have a 16, which has passed the threshold, and instead I’ll place a 9, Return to Caller, and we see that the value has not passed the threshold. This is extremely valuable if you have code reading from many sensors or test points. Let’s say I want a certain shutdown procedure to occur if a temperature surpasses a threshold value, or I want additional analysis if my device under test outputs a certain waveform. Rather than actually having to run the hardware and try to recreate those scenarios, I can simply have the subVI that calls those sensors output the value I want. Ok, you can stand back up, and cheer.”