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
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
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
07-01-2009 01:10 AM - 已編輯 07-01-2009 01:11 AM
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
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
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
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
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
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
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