LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Local Variable Alternative

"Use local variables to ... pass data between block diagram structures that you cannot connect with a wire" (LabVIEW 7 Express User Manual: Local Variables).

 

 I would like to pass some data around between block diagram structures.  However, there is no need to change or display the value on the front panel at runtime.

 

Basically, I would like the functionality of a local variable without the front panel object requirement.   What is the best way to achieve this?

0 Kudos
Message 1 of 4
(3,687 Views)

Look  up Functional Global Variable, LV2 style global variable, or Action Engine on the forums.

 

You use a subVI that is set to non-reentrant.  They contain a while loop that has a true constant wired to the stop terminal so that it only runs once.  It uses an uninitialized shift register between calls to store the data.  In its simplest form, it will have a case structure inside with Get and Set cases to return the data or set a new value.

Message 2 of 4
(3,680 Views)

If you right-click on the object in the Front Panel, go to Advanced>>Hide Indicator it will hide the indicator from the front panel.

 

Hope this helps.


--Brad

0 Kudos
Message 3 of 4
(3,658 Views)

Yes, that will work to an extent, but the main problem remains from the Local Variable is that you have very little control over exactly when it updates unless you start putting other structures around it. In addition, with a Local Variable all you can do is store a bit of data. With a Functional Global or action engine you can perform other operations inside the storage function. For example, say you want a variable that automatically initializes itself by reading data from a ini file or a database. Or say you want a function that can automatically provide persistent storage of values that you send to it.

 

Functional globals are much better - and more powerful way of managing things.

 

Mike... 


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 4
(3,632 Views)