03-12-2012 03:02 PM
I've always passed boolean values through local variables, but I just ran into a sub-VI that passes a boolean reference which then feeds a property node which sets the boolean's "Value" property to false. What are the benefits of using the reference like this instead of simply passing the boolean in and out of the sub-VI? Thanks.
Solved! Go to Solution.
03-12-2012 03:20 PM
You can use the same sub-vi for any boolean control and you can remote control indicators and controls from other parts of the program. Apart from that it's alot slower.
/Y
03-12-2012 03:24 PM
The only benefit is that you can access a terminal that is on the calling VI from within the subVI without having the subVI return (e.g. it could be an interactive subVI). On the other hand, it is much more demanding in terms of resources.
Typically you pass boolean values by wire. In very rare occasion, local variables need to be used.
For more detailed analysis, please show us some code so we better can see what you are talking about.
03-12-2012 03:25 PM
Writing to the Value property with a refnum updates the value in the calling VI at that moment instead of waiting for the subvi to finish and update the indicator outputs. I use them for simple, infrequent front panel updates from a background subvi when a queue or notifier is overkill.
What do you mean by you always pass bool with local variables?
03-12-2012 03:36 PM
The example I am discussing is actually from the Core 3 course work, Excersize 4-1. I'll attach images of the main loop and the sub-VI, "Flash."
Thanks to everyone for your help.
03-12-2012 03:37 PM
I mis-spoke about wiring the local variable. I wire the boolean itself into the sub-VI, or I sometimes wire a local variable, when necessary and appropriate.
03-12-2012 03:55 PM
I'd say that excersize shows how to control an indicator from a sub-vi. It'd be better in this case to control it direcly in the event i'd say.
/Y