Society of Robots - Robot Forum

Software => Software => Topic started by: airman00 on April 14, 2009, 12:15:37 PM

Title: Error from 16 bit timer capture
Post by: airman00 on April 14, 2009, 12:15:37 PM
How can I figure out how much percent error I should expect from a 16 bit timer capture ?
I'll be using an AVR microcontroller running at 20MHz with a clock rate of 50nS.

Any links or info would be helpful.
Thanks
Title: Re: Error from 16 bit timer capture
Post by: Webbot on April 18, 2009, 11:59:00 AM
Not quite sure what you mean by percentage error - percentage of what? 

If you are using the timer in input capture mode then when the input changes the timer value in TCNT is latched into the input capture register ICR. It will sit here unchanged until you read it. Since this is happening in hardware it should not be effected by interrupts. That is why atmel recommend using ICR for things like measuring frequencies and duty cycles.
Title: Re: Error from 16 bit timer capture
Post by: Admin on May 27, 2009, 07:03:17 PM
I think he means % accuracy of an event he is trying to measure. For example, can he measure a 10ns event with with a 16 bit timer at 20MHz.

airman00, you should link the other post that solves the problem to here ;D