LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exit from event driven subvi

Hey all Labview Gurus!

I have LV 7.1 (Win XP), I run a data aquisition program which collects data from the serial port. I have a lot of different subvis with different analysis functions. To enter these subvis I have event structures to identify a button pushed on the control panel. The problem is thatI cannot solve the exit from the subvi back to the main vi. As it looks now the event structure is inside a while loop running paralell with the main while loop (doing all the signal analysis etc). This way I have to press exit button twice for the VI to shut down (once per while loop I reckon). If I place the event structure inside the main while loop nothing seems to work, and when I place the event structure outside the event structure without running inside a while loop it does not work either. The main loop is placed inside a stacked sequence structure because the program has to do som sequential initialization before running the main loop.

Was this unclear enough for you? 😉

Cheers,

Mike
0 Kudos
Message 1 of 5
(2,813 Views)
Are you using a consumer/producer approach to your program? When you put the event structure inside a loop it waits for a user event that you have specified to occurer. You loop will not continue until that condition is triggered. If you place it outside the loop it will only execute once, that is why you have to put the event structure inside a loop. What you can do in a consumer/producer vi is have the consumer loop register an event and have that "call" back to the producer and stop your two loops from continuing. If you could attach some code that would help.
Ben
0 Kudos
Message 2 of 5
(2,797 Views)
Hey,

I attached some code from the program that I am working on.

/Mike
0 Kudos
Message 3 of 5
(2,765 Views)
Mike_SWE,
You can eliminate running two loops by placing your code in the timeout portion of the event sturcture. I have edited your code and reatacted it. I hope this helps.
Message 4 of 5
(2,758 Views)
Thank you for your most valuable help. the most obvious solutions are almost always the best ones 😉

Cheers,

Mike
0 Kudos
Message 5 of 5
(2,738 Views)