Re: More accurate Timerevent
- From: Gert Baars <g.baars13@xxxxxxxxx>
- Date: Mon, 20 Nov 2006 14:54:43 +0100
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?
.
- Follow-Ups:
- Re: More accurate Timerevent
- From: Dirk Claessens
- Re: More accurate Timerevent
- From: alanglloyd@xxxxxxx
- Re: More accurate Timerevent
- References:
- More accurate Timerevent
- From: Gert Baars
- More accurate Timerevent
- Prev by Date: Re: More accurate Timerevent
- Next by Date: Re: More accurate Timerevent
- Previous by thread: Re: More accurate Timerevent
- Next by thread: Re: More accurate Timerevent
- Index(es):
Relevant Pages
|