LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pause timed loop

I have a VI that generates some analuoge outputs. Since this is time sensetive I have put it in a timed loop with a fixed period time. I have no problems geting it to work so far.

The problem is that I would like to set the execution of the timed loop on pause with a boolean operator.

The timed loop is a part of a state machine that runs paralel with som other code.

 

I'm using LabView 7.1 and since I'm fairly new to this, coding exampels would be of great help.

 

/Rasmus

0 Kudos
Message 1 of 10
(3,803 Views)

Hi Rolesen,

you can use a case structure inside your timed loop to pause the execution of your code. You can use a queue to transfer the boolean value to it.

 

Mike

0 Kudos
Message 2 of 10
(3,802 Views)

Hi Mike

 

The thing is that I'm using the iteration number in the loop. I could get around that, but the loop is runing quite fast and there fore using a lot of CPU power. Thats the reason that I would like to pause or halt the loop.

 

I have been looking at som notifire and master / slave loops, but it haven't lead me to a solution.

 

Rasmus

0 Kudos
Message 3 of 10
(3,797 Views)

Hi Rasmus,

you can place a queue inside your loop and connect a timeout of "-1" to it. This is not the typical use of a timed loop, but it pause your loop.

 

Mike

Message Edited by MikeS81 on 07-01-2009 08:11 AM
0 Kudos
Message 4 of 10
(3,794 Views)

Hi mike

 

But how wil I get it going again? If I do that, won't the code then wait til the next iteration to read the "go" value? and since that iteration is haltet, lead to the code never starting again?

 

Rasmus

0 Kudos
Message 5 of 10
(3,790 Views)

Hi Rasmus,

as i wrote before, you can use a queue. Place a case structure in your loop, and connect the "timed out?" from the queue to the case structure. Do your normal code inside the true case. In the false case you can react on what you send to the queue, e.g. the new timeout value. If you send "-1" the loop will "pause" if you send a value >= 0 the loop runs.

 

Mike

0 Kudos
Message 6 of 10
(3,780 Views)

It is common to use a time delay in many loops, especially if they're part of the UI. It gives the same effect as a timed loop but you can easy change the wait value on every iteration if it's needed.

 

I'd use a normal loop with a simple wait in it. The value of the wait is placed in a case to which you connect your boolean pause-button (or what you're using). That way you can have a normal wait and a -1

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 10
(3,772 Views)

Hi Mike

I have played a bit around with the ques. But I don't seen to be abel to get to work as I would like. Do you have a coding eksampel either as .jpg or one that can run in 7.1?

 

Thanks for your help Rasmus

0 Kudos
Message 8 of 10
(3,741 Views)

Hi Yamaede

I'm using the timed loop because I have some crucial timing isues.

And the delay I would like to make, is not defined by time. So the normal "wait" function won't do it for me.

 

/Rasmus 

0 Kudos
Message 9 of 10
(3,738 Views)

Hi Rasmus,

see the attached image. The "normal" loop is only to send the commands in this example. If you work on an real time target, then you shouldn't use a "normal" loop. The button is configured as "switch if pressed".

 

Mike

0 Kudos
Message 10 of 10
(3,728 Views)