iv
8025I–AVR–02/09
ATmega48P/88P/168P/328P
15 8-bit Timer/Counter2 with PWM and Asynchronous Operation ...... 144
15.1Features ..............................................................................................................144
15.2Overview ..............................................................................................................144
15.3Timer/Counter Clock Sources .............................................................................145
15.4Counter Unit ........................................................................................................145
15.5Output Compare Unit ...........................................................................................146
15.6Compare Match Output Unit ................................................................................148
15.7Modes of Operation .............................................................................................149
15.8Timer/Counter Timing Diagrams .........................................................................153
15.9Asynchronous Operation of Timer/Counter2 .......................................................155
15.10Timer/Counter Prescaler ...................................................................................156
15.11Register Description ..........................................................................................158
16 SPI – Serial Peripheral Interface ......................................................... 166
16.1Features ..............................................................................................................166
16.2Overview ..............................................................................................................166
16.3SS
Pin Functionality ............................................................................................171
16.4Data Modes .........................................................................................................171
16.5Register Description ............................................................................................173
17 USART0 ................................................................................................. 176
17.1Features ..............................................................................................................176
17.2Overview ..............................................................................................................176
17.3Clock Generation .................................................................................................177
17.4Frame Formats ....................................................................................................180
17.5USART Initialization .............................................................................................182
17.6Data Transmission – The USART Transmitter ....................................................183
17.7Data Reception – The USART Receiver .............................................................186
17.8Asynchronous Data Reception ............................................................................190
17.9Multi-processor Communication Mode ................................................................193
17.10Register Description ..........................................................................................195
17.11Examples of Baud Rate Setting .........................................................................199
18 USART in SPI Mode .............................................................................204
18.1Features ..............................................................................................................204
18.2Overview ..............................................................................................................204
18.3Clock Generation .................................................................................................204
18.4SPI Data Modes and Timing ................................................................................205