Go Down

Topic: What hardware timers available on the Arduino ? (Read 565 times) previous topic - next topic

prairiemystic

What hardware timer/counters are available on the Arduino (ATmega328)? Of the three, it looks like one is used for the Delay() and AnalogWrite() library routines. Milli() prob uses one? Also I'm not sure what timer interrupts exist in the stock Arduino.

Just trying to see what MCU resources I can use. I couldn't find docs about this.



gardner

There are several useful writeups explaining the timers and useful libraries for using them:
http://www.mythic-beasts.com/~markt/ATmega-timers.html
http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM
http://www.arduino.cc/playground/Code/Timer1
http://www.arduino.cc/playground/Code/SimpleTimer

For the most part, Timer0 is the only one that has dedicated functions.  It provides the interrupt source for delay() and millis() as well as PWM timing for pins 5 and 6.  The other timers are needed only if you need to do tones or PWM output on other pins.

Go Up