Jump to content

while loop with ms wait


Recommended Posts

Hello,

I'm trying to get loop speed and I've got result that I have not expected.

I set "wait until next ms multiple" to values from 10ms to 0 ms and I want to check how fast the loop runs.

Can anyone explain why when I set 1ms I get 2ms? Is there something wrong with the vi structure?

I attach vi that I use (created in LV8.2).

Download File:post-1959-1207817923.vi

Link to comment

I ran your test and I saw similar results. When the wait time was set to 1 ms, the average wait time was close to 2 ms. BUT, "wait until next millisecond multiple" vi is not made for critical timing. At 1 ms it is probably running up against a wall of how fast it can go back and forth between the OS. The wait until vi is like a sleep command that allows the OS to perform other tasks. If you are looking for better timing use the timed loop. I replaced the while loop with a timed loop in your example and I observed a measured time of 1.025ms for a setting of 1.0ms.

Download File:post-151-1207831749.vi

Link to comment

Too much time with Windows, and I totally forgot that TimedLoops were made for RT targets. With TimedLoop on cRIO I also get nice 1.01 ms, but even cRIO can't squeeze 1ms from a standard "while" (with RT version of "wait until..." ).

Thanks for the reminder! :)

Link to comment

QUOTE (souske @ Apr 10 2008, 09:18 AM)

Too much time with Windows, and I totally forgot that TimedLoops were made for RT targets. With TimedLoop on cRIO I also get nice 1.01 ms, but even cRIO can't squeeze 1ms from a standard "while" (with RT version of "wait until..." ).

I don't know anything about your application, but have you considered doing your ultra-time-critical work in FPGA? Or maybe some of it and then stream data as needed to the RT host?

Link to comment

QUOTE (souske @ Apr 10 2008, 03:18 PM)

With TimedLoop on cRIO I also get nice 1.01 ms, but even cRIO can't squeeze 1ms from a standard "while" (with RT version of "wait until..." ).

If you enable us support on the cRIO you can probably get closer to the 1ms target, by using the RT specific "Wait until next multiple" with 1000us as input.

/J

Link to comment
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.