LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determinate a loop if the interval is too long

How can I determinate a while loop if the interval is very long.
 
The contral singal has already been sent, but since the loop interval is too long(1hour)  the loop can not be determinated right away.
 
Thank you.
0 Kudos
Message 1 of 10
(4,482 Views)
You can use timed loops to do that, see attached example,
 
Mel
0 Kudos
Message 2 of 10
(4,477 Views)
Alternately, a more general (and somewhat cleaner) solution would be to create a timer VI of your own that subdivides the long time delay into smaller segments of 100 msec or so. This timer would continue to loop internally until either the total time has expired, or an event that you create for the purpose, fires.
 
Create the user event in the main VI and pass the reference to it into your timer VI. Inside your timer VI, register the event reference as a dynamic event and create an event case for it to abort the timer.
 
To abort the timer all you have to do is fire the event.
 
Mike...

Message Edited by mikeporter on 08-26-2005 11:13 PM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 10
(4,474 Views)
Instead of a delay, use the timeout event of an event structure with the desired timeout as your loop rate. SImply add a second event case triggered by the stop button.
 
See attached very simple example (LabVIEW 7.1).
0 Kudos
Message 4 of 10
(4,470 Views)
Thanks for all the answers. I have only tried one of them( the last one), and I got further question. the example works. What if instead of "stop" from the Front panel I want to use some interstate values to be the "event"? (Please refer the attachment). I changed "stop" to my interstate variable, but it did not work. Is there a way I can use "x or Y" to terminate the loop?
0 Kudos
Message 5 of 10
(4,449 Views)

I am not sure what you mean by 'interstate' but I've revised your VI as I understood it. If that's not good for you please clarify.

Maybr you tried to signal to the "stop" button and got an error? If this is the case, you need to change it's mechanical action from a 'latch' type a 'switch', and then reset the button back to FALSE inside the event case (as I did for your "x or Y" indicator).

0 Kudos
Message 6 of 10
(4,441 Views)

What is an "interstate value" or "-variable"?? I am not familiar with that term. A logical OR with a diagram constant that is FALSE just returns the state of the other input. What is the point?

"X or Y?" is currently an indicator. You should make it a control and replace the boolean diagram constant with it. See attached.

0 Kudos
Message 7 of 10
(4,441 Views)

Sorry. i did not make it clear.

"X or Y" is not one of the controls but a result from other part of my program, so I think i shoul have called it a indicater. The reason I use a logical OR to connect "false" and "stop" is I try to simplify my question.

 

0 Kudos
Message 8 of 10
(4,438 Views)

You can trigger an event by writing to a signaling property of the trigger.

In this case, create a property node for the stop button, select Value(signaling), and write a true to it elsewhere in the code.

See attached modification.

0 Kudos
Message 9 of 10
(4,433 Views)
Yes! "signaling property". This is what I want and works ok for my loop. Thanks a lot.
 
 
0 Kudos
Message 10 of 10
(4,428 Views)