System Control and Reset................................................................ 35
Internal Voltage Reference................................................................................. 40
Watchdog Timer ................................................................................................. 41
Timed Sequences for Changing the Configuration of the Watchdog Timer ....... 43
Interrupts............................................................................................ 44
Interrupt Vectors in ATmega8............................................................................. 44
I/O Ports.............................................................................................. 49
Introduction......................................................................................................... 49
Ports as General Digital I/O................................................................................ 50
Alternate Port Functions ..................................................................................... 54
Register Description for I/O Ports....................................................................... 63
External Interrupts............................................................................. 64
8-bit Timer/Counter0.......................................................................... 67
Overview............................................................................................................. 67
Timer/Counter Clock Sources............................................................................. 68
Counter Unit........................................................................................................ 68
Operation............................................................................................................ 68
Timer/Counter Timing Diagrams......................................................................... 69
8-bit Timer/Counter Register Description ........................................................... 70
Timer/Counter0 and Timer/Counter1 Prescalers............................ 72
16-bit Timer/Counter1........................................................................ 74
Overview............................................................................................................. 74
Accessing 16-bit Registers ................................................................................. 77
Timer/Counter Clock Sources............................................................................. 80
Counter Unit........................................................................................................ 80
Input Capture Unit............................................................................................... 81
Output Compare Units........................................................................................ 83
Compare Match Output Unit............................................................................... 85
Modes of Operation ............................................................................................ 86
Timer/Counter Timing Diagrams......................................................................... 93
16-bit Timer/Counter Register Description ......................................................... 95
8-bit Timer/Counter2 with PWM and Asynchronous Operation .. 102
Overview........................................................................................................... 102
Timer/Counter Clock Sources........................................................................... 103
Counter Unit...................................................................................................... 104
Output Compare Unit........................................................................................ 105
Compare Match Output Unit............................................................................. 107
Modes of Operation .......................................................................................... 108
Timer/Counter Timing Diagrams....................................................................... 113
2
ATmega8(L)
2486M–AVR–12/03