LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to aviod delays stopping time delayed secondary loop

I have a program with muliple loops, one of which does som edata logging.  All while loops terminate when a single stop button is pressed.   The problem is, my logging loop has a time delay in it, which can be set quite high (10 min sometimes) and when I click stop, that loop waits for the time delay to finish before terminating, effectively hanging my program until it finishes.  So I'm loooking for a better way, where the program will always shut down in a few seconds, no matter what my logging interval is.   I've attached an example vi that illustrates my setup.
0 Kudos
Message 1 of 9
(3,602 Views)
You have no way of interrupting the logging loop to detect the stop. Here is a modified version which will do what you want, I think.

Lynn
Message 2 of 9
(3,595 Views)
Thanks for the tip.

since I didn't care about slowness on the timescales of wire vs property node this is what I came up with; I use an event structure monitoring the stop indicator value change and having the log writing occur when that event strucure times out

I attached my new example VI in case someone else has a similar problem and wants to see a couple of different methods of solving it.
0 Kudos
Message 3 of 9
(3,585 Views)
I'm having a similiar problem, I'm only using one while loop and would like to stop it regarless of the delay
which can get as high as 30 minutes or more! how can I do this?
 
0 Kudos
Message 4 of 9
(3,431 Views)
JAMR,

Could you post your VI that you are using so we can see how your program is controlled?
Regards,

Jared Boothe
Staff Hardware Engineer
National Instruments
0 Kudos
Message 5 of 9
(3,405 Views)
Hi, All it is is while loop with a stop control or the error status as control to stop it.
 
if I insert a delay and wish to stop using the stop button this is  dependent ofn the delay
wait for millisecond function  value, this becomes a problem if the delay is for example 30 minutes
since it waits for the next loop iteration.
 
I would like to stop the vi as soon as I push the stop button regardless of the delay value
 
Thanks 
0 Kudos
Message 6 of 9
(3,386 Views)
JAMR,

It sounds like you are wanting some form of "break" statement.   This does not exist for what you are wanting.  What I would recommend is having a case structure in your while loop and a counter.  When the counter reaches a certain level, it will then run the code that you are wanting to do every X minutes.  This will then allow the while loop to iterate much more frequently so that you could click the stop button and stop the loop quicker.
Regards,

Jared Boothe
Staff Hardware Engineer
National Instruments
0 Kudos
Message 7 of 9
(3,358 Views)

Thanks Jared_B,

Where can I find an example of this application?

 

 

0 Kudos
Message 8 of 9
(3,349 Views)

Just use the Elapsed time function.



Message Edited by Dennis Knutson on 07-17-2008 12:18 PM
0 Kudos
Message 9 of 9
(3,343 Views)