At mega 16 or Atmega32 have 3 timeri.e.timer0, 1, 2.
Timer 0 and Timer 2 are 8-bit, whiletimer 2 is 16-bitwide. Eachtimer have their own TCCR (Timer/counter control register) for controlling different mode and clkprescaling.Also eachtimer have their own flag (overflow etc. flag’s).All timer share common register (TIFR) for their flag’s.
- TCNTn (TCNTn register is a counter)
- TCCRn(Timer/counter control register) where n=0,1,2
- TIFR (Timer interrupt flag register)
- OCRn (Output compare register)
Flag’s:
- TOVn (Timmer overflow flag)
- OCFn (output compare flag)
TIFR is common for all avr timer .
2) Timer 0:
- TCCR0 (Timer/counter control register for timer 0).
3)Timer 1:
Timer1 is a 16-bit timer and it is split into two bytes, TCNT1L (Timer1 low byte) and TCNT1H (Timer1 high byte).Timer counter have two control register and it’s has 16different modes. Also timer 0 have two OCR which are 16-bit wide. There are two separate flags for each of of Timer1 OCR registers, which act independently of each other.
- TCNT1L (Timer 1 low-byte)
- TCNT1H (Timer 1 High-byte)
- TCCR1A (Ist control register 8-bit)
- TCCR1B (2nd control register 8-bit)
- OCR1A (Ist Output compare register 16-bit )
- OCR1B (2nd Output compare register 16-bit )
- ICR1 (Input capture register 16-bit)