09-22-2017 06:20 AM
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
09-22-2017 07:05 AM
Please post your VI.
Regards, Jens
09-22-2017 07:06 AM
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.
09-22-2017 08:46 AM
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.
09-22-2017 08:55 AM
09-22-2017 08:58 AM
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.
09-22-2017 08:58 AM
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.
09-22-2017 09:26 AM
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:
09-22-2017 11:31 AM
2000 mikroseconds = 2 ms, not 20 ms...
Regards, Jens
09-22-2017 05:13 PM - edited 09-22-2017 05:42 PM
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