Author Topic: Error from 16 bit timer capture  (Read 2106 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Error from 16 bit timer capture
« 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
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Error from 16 bit timer capture
« Reply #1 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.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Error from 16 bit timer capture
« Reply #2 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