LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why isn't a toggle switch activated by a global variable

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?

 

 

0 Kudos
Message 1 of 4
(2,759 Views)

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.

Message 2 of 4
(2,755 Views)
It sounds like you have a very basic misunderstanding about how dataflow works. Code will help clairify things.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
0 Kudos
Message 3 of 4
(2,742 Views)

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

0 Kudos
Message 4 of 4
(2,728 Views)