LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Local Variable vs Boolean Reference

Solved!
Go to solution

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.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 1 of 7
(5,651 Views)

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 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 7
(5,644 Views)

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.

Message 3 of 7
(5,640 Views)
Solution
Accepted by topic author diarmaede

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?


--Using LV8.2, 8.6, 2009, 2012--
Message 4 of 7
(5,638 Views)

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.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
Download All
0 Kudos
Message 5 of 7
(5,633 Views)

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.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 6 of 7
(5,631 Views)

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 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(5,619 Views)