wiki:ArduinoTimers

Version 2 (modified by Eric Hazen, 2 years ago) (diff)

--

These notes apply to the ATMega328P (Uno etc) using the Arduino IDE and libraries unless otherwise noted.

The 328 has 3 timers:

Timer0 (8 bits)

Default settings for Arduino Pro/Mini? (8 MHz):

TCCR0A: 3
TCCR0B: 3
TCNT0: 80
OCR0A: 0
OCR0B: 0
TIFR0: 0
TIMSK0: 1

Used for delay(), millis() and micros(). Don't mess with it.

Timer1 (16 bits)

Not normally used. For simple use, see the TimerOne library.

Timer2 (8 bits)

Used by e.g. the tone() function.