LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to immediately abort a timed loop

Solved!
Go to solution

Im writing a program that when completed, could run for a very very long time. But I need a timed loop to execute every 60 secs. The two option I have come up with are these

 

1. Timed Loop executing every minute

2. Timed Loop executing every second, but processing the contents every minute.

 

First way means I can't stop the loop until the time expires (more desirable than the 2nd option), the second option relies on the ability to determine when a minute is up based upon a 1Hz iteration rate, but from what I am reading, the iteration counter will eventually get to its max value and just hold its value, while the loop continues to execute (hence I lose my logic for content execution)

 

I'm really hoping there is a way to do an immediate abort of a Timed Loop, but i'm not finding a way, lol

0 Kudos
Message 1 of 13
(3,606 Views)
Solution
Accepted by topic author ATE_Dude_22

1!.PNG

If the notifier gets a error notification it passes that error to the right side error node finishing the loop untimed.  Otherwise the notifier times out and passes on error to the node when you want to iterate


"Should be" isn't "Is" -Jay
Message 2 of 13
(3,602 Views)

That'll work Jeff, thanks much.

0 Kudos
Message 3 of 13
(3,567 Views)
The odd thing is..

I have never delivered a solution to my client's that used notifiers.

not that notifiers are "evil" but, you can often code around the need for "notification" by elegantly changing the data structure....


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 13
(3,551 Views)

Yeah, I'm seeing some random behavior I'm not quite sure about yet, but I appreciate the suggestion very much.

 

Thanks.

0 Kudos
Message 5 of 13
(3,548 Views)

For a 1 minute rate you don't need a timed loop. Why not use the timeout of an event structure and also include a second event to stop the loop immediately by breaking the timeout?

 

(If you also want to handle other events while keeping the timeout interval constant, see my old example posted here. See also my comment to this forgotten idea)

0 Kudos
Message 6 of 13
(3,535 Views)

If you want to use a timed loop, you can stop it at any time using the Stop Timed Structure tool. (even if the conditional terminal is hardwired to never stop!)

 

For example in the following code draft, pressing the stop button will stop and complete the timed loop immediately, no matter how long the interval is.

(Note: Configure the timed loop to get the current name, or set your own)

 

 

Message 7 of 13
(3,524 Views)

try this...

 

ABORT_BD.png

Message 8 of 13
(3,509 Views)

I think altenbach's solution is the best one...you can configure the Timed Loop to execute at the rate you want, and you don't have to worry about when the "abort check" code runs in relation to where you are time-wise in the current iteration.

Message 9 of 13
(3,502 Views)

@Darren wrote:

I think altenbach's solution is the best one...you can configure the Timed Loop to execute at the rate you want, and you don't have to worry about when the "abort check" code runs in relation to where you are time-wise in the current iteration.


would this work immediately, whether from user input or dynamic event? rather that waiting for a 10ms iteration loop to read a "stop" as suggested by altenbach.

timed loop_VI_BD.png

0 Kudos
Message 10 of 13
(3,457 Views)