19.1
19.2
Overview ........................................................................................................173
Description .....................................................................................................173
20 8-bit Timer/Counter2 with PWM and Asynchronous Operation ...... 175
20.1
20.2
20.3
20.4
20.5
20.6
20.7
20.8
20.9
Overview ........................................................................................................175
Timer/Counter Clock Sources .......................................................................176
Counter Unit ..................................................................................................176
Modes of Operation .......................................................................................177
Output Compare Unit .....................................................................................181
Compare Match Output Unit ..........................................................................183
Timer/Counter Timing Diagrams ...................................................................184
Asynchronous Operation of Timer/Counter2 .................................................185
Timer/Counter Prescaler ...............................................................................187
20.10 Register Description ......................................................................................188
21 SPI – Serial Peripheral Interface ......................................................... 196
21.1
21.2
SS Pin Functionality ......................................................................................201
Register Description ......................................................................................203
22 USART ................................................................................................... 206
22.1
22.2
22.3
22.4
22.5
22.6
22.7
22.8
22.9
Features ........................................................................................................206
Clock Generation ...........................................................................................207
Frame Formats ..............................................................................................210
USART Initialization .......................................................................................211
Data Transmission – The USART Transmitter ..............................................213
Data Reception – The USART Receiver .......................................................215
Asynchronous Data Reception ......................................................................219
Multi-processor Communication Mode ..........................................................222
Register Description ......................................................................................223
22.10 Examples of Baud Rate Setting .....................................................................228
23 USART in SPI Mode ............................................................................. 232
23.1
23.2
23.3
23.4
23.5
23.6
Overview ........................................................................................................232
USART MSPIM vs. SPI .................................................................................232
SPI Data Modes and Timing ..........................................................................233
Frame Formats ..............................................................................................234
Data Transfer .................................................................................................236
USART MSPIM Register Description ............................................................237
iv
ATmega640/1280/1281/2560/2561
2549L–AVR–08/07