Delay Calibration

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Delay Calibration

Post by Jeko »

How can I calibrate the delay?
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

You have a timer interrupt, that you can control how often it fires. You should be able to use this to time a specific chunk of code that will be repeated inside a high resolution timing function (if high resolution isn't required, the timer interrupt should be used, and the task should be blocked until approx. the number of ticks have elapse).

The code segment that's used to repeat, however, needs to be selectively chosen. The linux kernel, at one point, would real from a specific port for approx a 1us delay. This is fairly consistent. A trail of nop's, however, probably wouldn't be. The loop would eventually get cached, and therefore speed up.

--Jeff

PS: I don't know that this is how Linux, etc, calibrate delay loops... just a thought.
Post Reply