Re: Need to run function every 20ms.



Thx Chris
That looks perfect--not sure how I missed it.

"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:O5n5II0SIHA.4752@xxxxxxxxxxxxxxxxxxxxxxx
Take a look at the multimedia timer. Set it for a 20ms periodic firing.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Allan Lunk" <allan _at_ ByteWiseSG _dot_ com> wrote in message
news:%23q7qS3zSIHA.5524@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have read numerous posts asking similar questions, but my problem is
slightly different.

I have a function (thread) that needs to run every 20ms. I am reading
some counters and ADCs and up-dating some I/O based what I read. It is
important that I read things as regularly as possible. The function
takes several ms (varies) to complete, depending on what it need to do.
I can't (I think..) use Sleep(20), because this will start the 20 ms
after the function completes--and that time varies.

Is there a way to generate a consistent...something.... that will allow
my thread to sample and update I/O?

BTW. I don't have a timer on board that I can use to generate another
interrupt--this may need to change if I can't come up with another way.

thanks for any suggestions.





.



Relevant Pages

  • Re: Need to run function every 20ms.
    ... system timer, you'd then get a much more accurate and balanced system. ... Chris Tacke, Embedded MVP ... after the function completes--and that time varies. ... my thread to sample and update I/O? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Need to run function every 20ms.
    ... Take a look at the multimedia timer. ... Chris Tacke, Embedded MVP ... the function completes--and that time varies. ... thread to sample and update I/O? ...
    (microsoft.public.windowsce.embedded.vc)

Loading