LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need some help with the use of global variables.

I am trying to use global variables to get information (numeric) out of a sub-vi that I have inside of a while loop which is itself contained in a for loop.  All of this is contained in an event structure.  I also need to use globals to stop the while loop from the front panel.  Anyway, I thought that I would start with a simple vi that would read the iteration number from a while loop which could be turned off from a push button on the front panel.  The first try I didn't put the global that read the numeric value in a loop, and I am sure that is why it wasn't updated (front panel indicator never changed value).  Next I placed the stop button, its global write, and the numeric indicator and its global read in a while loop that would be stopped with the same stop button.  The numeric indicator updated, but the stop button has never worked.  Can anyone tell how I can make the attached work, first, and next point me to some intuitive information on the use of globals in labview?  I will include both the global vi and the one I used to attempt them.
 
Thanks,
Joe Ryan
Download All
0 Kudos
Message 1 of 4
(2,634 Views)

The basic problem lies in your use of the event structure.

First rule: in an event structure only use code that executes in a blitz.

or better said, don't use code that takes long to execute.
Your while loop takes a long time!

You can either remove the event structure completely and your program works

or inside the event loop don't lock the frontpanel while the event has not finished (if you look creful you find somewhere a boolean switch 

greetings from the Netherlands
Message 2 of 4
(2,626 Views)
I need for the program to start after a button has been pressed on the front panel, how is this accomplished without an event structure?
 
Thanks,
Joe Ryan
0 Kudos
Message 3 of 4
(2,607 Views)

You could use an event structure before your real program. Not writing your program in the eventstructure.

attached is your mdified program, no event structure and stil working.

All those wires between the while are necessary for sequence by wiring

greetings from the Netherlands
0 Kudos
Message 4 of 4
(2,588 Views)