LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a while loop within an event structure

I am using an event structure to run a selected set of measurements (when switched to true, the event structure executes a routine within a while loop based on the "true case"). The problem I am running into is that when my user switches the boolean back to false (stopping the data collection) the case structure switches to the false case, which wll not allow me to stop the while loop in the true case, so it keeps running... I have tried local variable, but since the value of the case structure is false, the true case never executes, to stop the while loop... Any ideas?
One should welcome adversity as an opportunity to excel.
0 Kudos
Message 1 of 5
(2,835 Views)
Most likely your event case is set to lock the front panel until it completes, so the button press is not seen.
 
You can uncheck the "lock panel" in the event configuration, but that does not solve the issue of poor code architecture. Interactive while loops don't belong inside event cases.
0 Kudos
Message 2 of 5
(2,829 Views)
As always, I appreciate the advice, and the positive reinforcement.Smiley Sad I guess I am still learning...

I already had the front panel unlocked. Do you have any suggestions as how to perform a measurement that needs to be "continuous" but only for a user-specified (and always wildly varying) amount of time? There are multiple controls on the front panel that can be in multiiple configurations (thus event structure). Instead of a while loop within the case structure, is there another method by which I could accomplish what I want?

I really do appreciate your help.
 
Chris
 
 
One should welcome adversity as an opportunity to excel.
0 Kudos
Message 3 of 5
(2,815 Views)
You can use the outer while loop for everything, place the repetitive code in the timeout case, and manipulate the timeout with your controls.
 
For example, have a look at my example in this similar (but old) thread:
 
There are many other possibilities, for example you can place the repetitive code in a parallel while loop and manipulated it with queued messages, for example.
 
 

Message Edited by altenbach on 10-30-2007 12:02 PM

0 Kudos
Message 4 of 5
(2,805 Views)

I took your advice and moved the loop into my DAQ section(where it should have been all along), instead of the GUI loop. It was a little more labor intensive, but I suppose all the good things are...

Everything seems to be working fine now. Thanks for your help.

Chris

One should welcome adversity as an opportunity to excel.
0 Kudos
Message 5 of 5
(2,776 Views)