LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop in a timed while loop

Solved!
Go to solution

Hello,

 

I have a while loop with a stop function in it. There is also a wait function of 60 seconds to slow down the while loop.

 

 

The problem is that when I press stop in the while loop it has to wait to stop because of the timing function. How can I get around this as I would like to press stop and have the while loop immediately end.

 

The .vi is attached showing while, stop and timer functions.

 

 

0 Kudos
Message 1 of 4
(3,112 Views)

Use an event structure inside the while loop.  Wire the timeout to the 'milliseconds to wait between saves' and put everything else inside the timeout event case

 

Make another event case for the stop button which sends a 'TRUE' to the 'stop if true'.

 

Clicking the stop will generate the event and stop the vi.  If stop not clicked the timeout case will execute every period you specify in 'milliseconds to wait between saves'

 

Hope this helps

 

Ken

0 Kudos
Message 2 of 4
(3,108 Views)

Hi Ken,

 

Thanks for your reply. I think I know what you mean but if you have the time could you show me some example code!

0 Kudos
Message 3 of 4
(3,101 Views)
Solution
Accepted by topic author nevica

Try this to get you going

 

Ken

0 Kudos
Message 4 of 4
(3,079 Views)