Kenny K>> But what I have learned and read on the forums, is that references are much nicer than varibales (global), in that they requiore much less memory and computing power when dealing with transfereing data to and from subvis. Also, local variaables cannot be used to transfer data from a subvi in "real time". Globals can be tricky (in my experience) to get data to transfer from a subvi to a main VI.
References can pass data from a subvi in real time, which makes it ideal for this stype of situation and they are very simple to implement.
I agree.
In this particular case, with the front-panel LEDs etc., it's possible to update in real time by writing the Value property of a global reference to the LEDs. The only benefit to doing this is that you don't have to wire the reference to the subVI. The drawbacks are worse. Rather than use a global reference, in general it's better to wire the reference, even if you already have a cluttered diagram.
Better still, usually, to store references to front-panel objects within a subVI that's responsible for managing one or more front-panel items. This is the "functional global" concept. You pass in the reference at the first call to the subVI ("Initialize" step). The reference is stored in a shift register within the subVI. The value of the shift register persists as long as the subVI is in memory; that is, it persists across calls to the subVI (unless the subVI isn't in memory, e.g. if it's called only with an Invoke Node or whatever). Then, to update whatever the reference points to, pass in enumerated values, or strings, to the subVI that stores the reference. Each of those enumerated or string inputs is a mnemonic for an action. Like, "Hide" could tell the subVI to set the Visible property of the appropriate reference to False.
(In C/C++ terms, the shift register in the subVI is a type of static variable.)
The functional-global solution minimizes wiring, abstracts data, and can maintain state information internally. So "functional global" is a term that doesn't do justice to the idea. But the term is widely used and I haven't thought of a better one....
::Marty