LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed Loop in LabView RT cRIO

Dear all,

 

I have a setup the period of timed loop to be 2000 microseconds, however, when I calculate the loop time using tick count (in milliseconds), it is different than the period. The period still shows me 20 ms, but the loop time indicate 10 ms. Is the period in timed loop different than the actual loop time, if yes, then what is the difference. If not, then what can be the reason behind this?

 

Regards,

Noor

0 Kudos
Message 1 of 12
(1,773 Views)

Please post your VI.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 2 of 12
(1,749 Views)

Hi NoorForWind,

 

welcome to the forum. a quick prelude: it is always helpful to illustrate the problem with a vi or snippet, so that others see what you have done, otherwise implementation problems are only guesswork.

 

attached a snippet to compare the high-resolution and tick-count vis in a timed-loop.

timed-loop.pngtimed-loop-frontend.png


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 3 of 12
(1,747 Views)

Unbenannt.png

Here is the snippet... As you can see that the "Period" indicator is showing 2000 microseconds (configured by me in the timed loop). However, the "Loop time" indicator shows 10 milliseconds (1000 microseconds). I am trying to run the timed loop slightly slower so that I can see the effect on the performance of the controller.

0 Kudos
Message 4 of 12
(1,719 Views)
You have quite a lot of code inside your loop which probably takes longer to execute.

Regards, Jens
Kudos are welcome...
0 Kudos
Message 5 of 12
(1,713 Views)

that is an image, not a snippet 😉 you can create snippets (which are .png with xml embedded) going through the menu "Edit -> Create Snippet".

its almost the same as a vi, since you can drop the image on a blockdiagram and have a functioning vi. note that the drag and drop function of the forum is broken, see the sticky in the forum, so it is best to also attach the .png to the post

 

also build a minimal vi that illustrates your problem and try to produce the same error there.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 6 of 12
(1,712 Views)

Well that's the point.... I am trying to run the timed loop slower i.e., 20 ms. However, for some reason the timed loop is running faster then I have specified i.e., 10 ms.

0 Kudos
Message 7 of 12
(1,711 Views)

my guess at the moment is, you measure the actual execution time inside the loop, which is faster than your defined period.

the timed loop will wait the remaining time and then iterate on the next period.

so everything is ok.

 

check yourself with:

 timed-loop-2.pngtimed-loop-2-frontend.png

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 8 of 12
(1,702 Views)

2000 mikroseconds = 2 ms, not 20 ms...

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 9 of 12
(1,687 Views)

20ms is correct

1MHz clock is 1 tick per microsecond (1/10^-6)

if we wait 2*10^4 ticks (20000 µs)

the loop time is 2*10^-2 ticks (0,02 s or 20ms or 20000µs)

 

bet you just misread 20,000 for 2,000, and had me confused for a second 😉

and NoorForWind you also mistyped 10ms as 1,000microseconds


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 10 of 12
(1,675 Views)