Re: More accurate Timerevent



nowhere@xxxxxxxxxxxxxx schreef:
Gert Baars <g.baars13@xxxxxxxxx> wrote:

When Timer interval gets below 200 (millisec)
the timer event becomes increasingly inacurate.

My application requires 20 mS accurate (50 Hz sampling rate for FFT)
timer events. Is this somehow possible (Delphi 7).
I prefere to avoid a thread.


In general, precision timing under Windows is an unsolvable problem
unless you add some specialised hardware, because Windows was not
developed as a realtime system.

You can access some higher precision timers than the VCL TTimer using
the Win32 API function timeSetEvent(), which is (allegedly) accurate
to 1 millisecond (ms). However, in Windows' multithreaded
environment, this accuracy is not reliable when other high-priority
threads are demanding processor time.

If you need to measure a time-critical algorithm then do not use the
GetTickCount() function. Instead, use the Win32 API functions
QueryPerformanceCounter() and QueryPerformanceFrequency().
(Windows.pas)

Some of my colleagues used them successfully for an FFT application
(processing real-time sonar data) from Borland C++Builder.
Should work equally well with Delphi.


____
Chimaera

Hello,

Thank you for info. I'd like to try timeSetEvent but Delphi 7 doesn't
recognize it and helpfunction neither. Do I need to add a .dcu at 'uses'? Is this somehow documented?


.



Relevant Pages

  • Re: More accurate Timerevent
    ... the timer event becomes increasingly inacurate. ... My application requires 20 mS accurate (50 Hz sampling rate for FFT) ... Is this somehow possible. ...
    (alt.comp.lang.borland-delphi)
  • Re: More accurate Timerevent
    ... the timer event becomes increasingly inacurate. ... My application requires 20 mS accurate (50 Hz sampling rate for FFT) ... use the PCM bits for the timing. ...
    (alt.comp.lang.borland-delphi)
  • Re: [ANN] AM Software releases LA Multi-Script
    ... I was a little bit curious if LA MS could be used somehow with ... Delphi. ... Isn't this really up to the forum moderators to decide? ... Kevin Powick ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: IDE Crashes related to code folding?
    ... Heheh, somehow this same thread is going on in bcb.non-tech, and Alex ... also said Delphi was in C. ...
    (borland.public.delphi.non-technical)
  • Re: Going back to Delphi 7
    ... At 01:35:47, 18.07.2005, SupportX wrote: ... Somehow that is a rather lame analogy to the Kennedy quote. ... what you can do for your customers, using Delphi, depends partly on the ...
    (borland.public.delphi.non-technical)