06-03-2014 03:42 PM
I created test.vi with a toggle switch and used a local varable to read the switch. In the vi when I wrote to the local variable, the toggle switch would change accordingly. I can manually set the toggle to the true state and then the vi can reset the toggle to the false state when it is done.
When I use test.vi inside of another vi I now have the toggle located on the panel of new.vi. For this vi to work I had to change to global variables. New.vi works as expected except for one thing. I manually switch the toggle it sets the toggle global variable to true and it starts test.vi running. When test.vi completes it sets the toggle global variable to false but the toggle doesn't change to the false state.
In the case of the local variable the toggle works as desired but when I use global variables it doesn't. Why?
06-03-2014 03:45 PM
Post your VI. It sounds like you are choosing to use native globals without considering the consequences. They are not always the best answer to getting your data around your application.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-03-2014 04:13 PM
06-03-2014 04:41 PM
The global variable might have the same name and the same data, but it does not link to the control.
As the other posts have indicated, local and global variables in LabVIEW do not work the same way they do in text-based languages. A local variable is essentially a duplicate terminal for a control or indicator. The "variable" is really the wire. Many very large and complex LV programs use no local or global variables.
Lynn