LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cancel (break out of) WAIT timer delay

Is there a way to break out of the WAIT(ms) VI and continue with reset of program.

e.g. I set the WAIT(ms) timer to wait for 20 seconds (or 20 minutes). At some point before the end of the timer, I decide I want to cancel it and continue the program, or reset it to another value.

Is there an easy way out of this? Or am I resigned to putting a 1 second or less WAIT in a loop and count to the desired time myself, in which case I could interrupt it.
0 Kudos
Message 1 of 13
(7,592 Views)
Once it starts waiting, you're stuck with it. The only way out would be to use the Abort button, but that's not the way to go.

One other way to do this would be to use an Event structure. Create a Timeout case and set you wait to the timeout terminal. Then have another case monitor your cancel button and that case will fire right away, "cancelling" the long wait time.

If you don't have at least LabVIEW 6.1 and can't use the Event structure, you'll have to use the shorter wait and count method you describe.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 13
(7,592 Views)


Hi,

If you want to wait for a variable amount of time, which is determined at run-time in your logic, you may want to consider using Occurrences. With Occurrences, you can "wait" in some part of the code, and then fire an occurrence from some other (or even same) part of the code whenever you wish and stop the waiting.

Occurrence functions can be found under Advanced>>Synchronization on the Functions pallette. See LabVIEW's online help for details. Also, see the shipping examples found in your LabVIEW folder at:
\examples\general\ocurence.llb

However, if you HAVE TO use the WAIT function, you are resigned to the idea of putting a small wait in a loop and controlling the loop iterations.

Hope this was helpful,

Khalid

Message 3 of 13
(7,592 Views)
Lets assume you have LV6.1 or later. If so, I would use the event structure instead of the wait function. If you have LV7.0 or later, the dynamic event structure would be the way to go. With the dynamic event structure you can break out of your "wait mode" based upon a condition.

If you have previous version of LabVIEW (
Good luck

Robert
0 Kudos
Message 4 of 13
(7,592 Views)
pfh wrote:

> Is there a way to break out of the WAIT(ms) VI and continue with reset
> of program.
>
> e.g. I set the WAIT(ms) timer to wait for 20 seconds (or 20 minutes).
> At some point before the end of the timer, I decide I want to cancel
> it and continue the program, or reset it to another value.
>
> Is there an easy way out of this? Or am I resigned to putting a 1
> second or less WAIT in a loop and count to the desired time myself, in
> which case I could interrupt it.

Just put a much shorter timer inside a while-loop.

Than you are free tu end the loop whenever you want. Use the "wait for
next multiple" to get "clean" intervalls (otherwise the execution-time
of the loop will add up).

I hope, ths helps a bit

bye

Marco
0 Kudos
Message 5 of 13
(7,592 Views)
Check out this thread.

Here.


Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 13
(7,591 Views)

thanks! for the tip

 

0 Kudos
Message 7 of 13
(6,555 Views)

Maybe it would bebetter if you told us more specifically why you need this to happen.  I'm sure we can find a much better solution based on what you tell us.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 13
(6,539 Views)

Andddddd 10 years later...

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

LOL - I didn't realize it was that old.  I've seen older, but by much.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 13
(6,533 Views)