LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI inputs and outputs in Labview 5.1.1

Somewhat..For my boolean indicator, what is the difference between a local variable and its terminal representation.  I have the local variable in the while loop and the terminal outside the loop.

 

0 Kudos
Message 11 of 14
(660 Views)


BME genuis wrote:

Somewhat..For my boolean indicator, what is the difference between a local variable and its terminal representation.  I have the local variable in the while loop and the terminal outside the loop.


For all practical purposes, there is no difference.  Sending a wire to a local variable does the same thing as sending the wire to the terminal of an indicator.
 
It does make an extra copy of the data in memory and will run slightly slower than which comes into play if you are updating the indicator at a rapid pace in a loop. 
Also, careless use of local variables can lead to "race" conditions, which if you keep reading the forums, you will find discussed frequently.
0 Kudos
Message 12 of 14
(656 Views)
Then what is the advantage of using a local variable over its terminal?
0 Kudos
Message 13 of 14
(647 Views)

Whenever possible, you should wire to a terminal. The local gives you the ability to write to a control and read from an indicator. Tt allows you to write or read in different locations of your block diagram. They are not necessarily evil but you do need to be careful in their use. Because a normal local has no dataflow, it's very easy to have a race condition where the order of a read and a write is unknown. Some new users will use a local with the idea that it makes for 'neater' wiring. Not a valid reason.

0 Kudos
Message 14 of 14
(641 Views)