取消
顯示結果 
搜尋替代 
您的意思是: 

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 積分
1 條訊息(共 10 條)
5,087 檢視

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 積分
2 條訊息(共 10 條)
5,086 檢視

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 積分
3 條訊息(共 10 條)
5,081 檢視

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 積分
4 條訊息(共 10 條)
5,078 檢視

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 積分
5 條訊息(共 10 條)
5,074 檢視

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 積分
6 條訊息(共 10 條)
5,064 檢視

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 積分
7 條訊息(共 10 條)
5,056 檢視

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 積分
8 條訊息(共 10 條)
5,025 檢視

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 積分
9 條訊息(共 10 條)
5,022 檢視

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 積分
10 條訊息(共 10 條)
5,012 檢視