Real Time Windows extensions / very fast timer?

Please discuss general Delphi programming topics here.

Real Time Windows extensions / very fast timer?

Postby Tommyjunge » February 17th, 2006, 7:55 am

Does anybody know if there are freeware real time extensions for windows (comparable to the payversion http://www.ardence.com/embedded/products.aspx?ID=70 )
preferably with Delphi interface?

Actually, I do not need hard realtime but only a very fast timer (about 10 thousand shots per second). Is there a solution for this?

Regards, Thomas
Tommyjunge
Active Member
Active Member
 
Posts: 17
Joined: January 31st, 2006, 7:03 pm

Postby Johnny_Bit » February 17th, 2006, 9:15 am

RTC can do as much as 8192Hz, so less than 2kHz from your 10 kHz... You use it usually in assembler. Don't count on cpu on this...
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Tommyjunge » February 17th, 2006, 10:43 am

8kHz is fine.

How do I use RTC to fire Delphi events with that rate?

Regards, Thomas
Tommyjunge
Active Member
Active Member
 
Posts: 17
Joined: January 31st, 2006, 7:03 pm

Postby Kambiz » February 17th, 2006, 12:40 pm

Look at QueryPerformanceFrequency and QueryPerformanceCounter Windows API. You may find them usefull.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Tommyjunge » February 17th, 2006, 6:56 pm

Hello,

@ Kambiz:
As far as I have found out QueryPerformanceCounter can't fire events. It's just a very accurate clock.

@ Jonny_Bit
If you mean real time clock with RTC that would work quite nicely under DOS, where I can tweak the hardware timers and reroute hardware interrups as I have done in the past.
Only problem: I don't know how to achieve that under Windows.
I suspect it won't work. When I did that under DOS, the network stuff failed to work.

The fastest Windows timer I found is the MultimediaTimer which can fire at 1kHz max.

Can anybody think of anything faster? Maybe with external hardware? Could maybe the serial interface be used to fire events at higher rate?

Regards Tom
Tommyjunge
Active Member
Active Member
 
Posts: 17
Joined: January 31st, 2006, 7:03 pm

Postby Kambiz » February 18th, 2006, 1:25 pm

You can create your own timer by a Thread with TimeCritical priority and using QueryPerformanceFrequency and QueryPerformanceCounter.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Tommyjunge » February 18th, 2006, 8:15 pm

Wouldn't the time critical thread eat up most of the CPU time testing the clock for the right time to fire an event?
Or, if I use sleep(0) in the thread, wouldn't I get stuck at the 10 millesecond time slice limit of Windows?

Regards, Tom
Tommyjunge
Active Member
Active Member
 
Posts: 17
Joined: January 31st, 2006, 7:03 pm

Postby Kambiz » February 18th, 2006, 11:21 pm

No idea! :roll:
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Johnny_Bit » February 19th, 2006, 6:33 pm

Well, if you set thread to timecritical such thing... it would eat you up. On 1 singlecore processor. It would be even less accurate that normal, because from time to time it would get stopped to allow other apps use cpu. On dualcore/smp no harm done.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Re: Real Time Windows extensions / very fast timer?

Postby TheEdge » March 15th, 2006, 8:07 am

Tommyjunge wrote:Does anybody know if there are freeware real time extensions for windows (comparable to the payversion http://www.ardence.com/embedded/products.aspx?ID=70 )
preferably with Delphi interface?

Actually, I do not need hard realtime but only a very fast timer (about 10 thousand shots per second). Is there a solution for this?

Regards, Thomas


Have a look at timeSetEvent windows API call
TheEdge
Active Member
Active Member
 
Posts: 15
Joined: March 14th, 2006, 8:47 pm

Postby Tommyjunge » March 15th, 2006, 10:43 am

WinAPI timeSetEvent doesn't help because the minimum possible delay time to be set is 1 millisecond and multiples of this.

Practically, a delay below 10ms is not possible with this timer.

1ms can be achieved with the multimediatimer of WinMMApi.

I need delays of 0.1ms, though.

Thanks, Thomas
Tommyjunge
Active Member
Active Member
 
Posts: 17
Joined: January 31st, 2006, 7:03 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron