LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to stop a while loop which contains a timed loop

Hi,
 
I'm a new hand to labview, and I'm using labviw 7.1, NOT 8.x.  I'm trying to do a measurement, in which the flow would look like the attached file (I have stipped all hardware related components to make it easy to read).  My questions are:
 
1. In Loop 3, when the comparison (x>20.85) is true, Loop1, Loop2 and Loop3 are stopped, why it won't quit the while loop (I have wired it to  while loop stop)?
 
2. When it is running, I click on stop button, why it won't stop?
 
Thanks!
 
  
0 Kudos
Message 1 of 2
(2,844 Views)


hwm wrote:
 
2. When it is running, I click on stop button, why it won't stop?
 
  


The stop button is read outside of the inner while loops.  So the inner while loops will continue to run until their stop conditions are met.


hwm wrote:
 
 
1. In Loop 3, when the comparison (x>20.85) is true, Loop1, Loop2 and Loop3 are stopped, why it won't quit the while loop (I have wired it to  while loop stop)?
 
  


It seemed to me like it would, but sometimes it seemed like I had to set change the numeric value one more time before it would.  You have a very odd structure there by placing the event structre inside the while loop with the other loops.  I think you may be running into issues where events are getting queued up in the event structure, or race conditions between when the event structure might execute relative to the other loops.  It is all very odd and difficult to predict all the ways these structures might interact and relative timing.  Usually event structures would belong in their own parallel while loop.  I think you need to rethink exactly what you are trying to do here.  It probably isn't event necessary to use the stop timed structure functions.  A local variable or a notified to pass the "Stop status" from loop 3 to the other loops (or the separate event structure loop to the other 3) would probably be better.

Message 2 of 2
(2,836 Views)