FIRST STEPS WITH AVR

TIMER2 is a 8-bit Timer with PWM and output compare functions like TIMER1. The most interesting feature of TIMER2 it that it can use a external crystal separate from the system clock and the clock source.

The Timer1 of the AVR ATMEGA328 microcontroller is a 16 bits timer/counter that is much more versatile and complex then the 8-bits TIMER0. Timer1 contains one 16-bit input capture register and two 16-bit output compare registers. The input capture register is used for measuring pulse widths or capturing times, while output compare registers are used for producing frequencies or pulses from the timer/counter to an output pin on the microcontroller. TIMER0 is usually started, stopped, and reset, while TIMER1 is usually left running.

Timers and counter are the most used peripherals in a microcontroller. They are being able to measure time periods, measure frequency, determine pulse width or provide output signals. Example applications might include producing tones to create music, create a time base for a real time clock or measure rpm of an engine. Timers and counter are simply binary up-counters. In timing mode the binary counter are counting the time periods and in counter mode, they are counting the events or pulses.