LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

force stop while loop

Solved!
Go to solution

Hello,

 

I am trying to write a VI that do some operation within a while loop. I have replaced the operation with some simple math operation in the attached VI picture. For the loop in the picture, I just want to add 1 every 15sec. until it reaches 10 and stops. However, I also want to be able to force stop the while loop without waiting the whole 15sec till the next iteration. Is there a way to break the wait time for the while loop? Thanks for the help!

Download All
0 Kudos
Message 1 of 7
(6,918 Views)

No.

 

If you want to stop your while loop earlier, you need to use a much shorter wait in there.  Only do what you want whenever the 15 seconds has passed, perhaps by using the Elapsed Time Express VI.

0 Kudos
Message 2 of 7
(6,896 Views)

As RavensFan suggested, break your 15 seconds wait into smaller values. Here is a quick example.

 

Ben64

 

abort wait.png

Message 3 of 7
(6,891 Views)

Use an event structure with a 15000ms timeount and an event for the stop button. Pressing stop will immediately break the timeout.

 

 

0 Kudos
Message 4 of 7
(6,882 Views)
Solution
Accepted by MaxXx

@altenbach wrote:

Use an event structure with a 15000ms timeount and an event for the stop button. Pressing stop will immediately break the timeout.


Here's what I had in mind (LV 8.5).

 

Download All
Message 5 of 7
(6,876 Views)

@altenbach wrote:

@altenbach wrote:

Use an event structure with a 15000ms timeount and an event for the stop button. Pressing stop will immediately break the timeout.


Here's what I had in mind (LV 8.5).

 


When I saw the image I didn't understand. The wire to the sandclock is hidden I have corrected. 🙂

Timeout.png

-----

The best solution is the one you find it by yourself
Message 6 of 7
(6,867 Views)

Thanks, the wire must have slipped under there unnoticed when I resized things for the final save.

0 Kudos
Message 7 of 7
(6,855 Views)