English
Language : 

ATMEGA328P-20AU Datasheet, PDF (416/420 Pages) ATMEL Corporation – 8-bit Atmel Microcontroller with 4/8/16K Bytes In-System Programmable Flash
18 8-bit Timer/Counter2 with PWM and Asynchronous Operation ...... 142
18.1Features ..............................................................................................................142
18.2Overview .............................................................................................................142
18.3Timer/Counter Clock Sources .............................................................................143
18.4Counter Unit ........................................................................................................143
18.5Output Compare Unit ..........................................................................................144
18.6Compare Match Output Unit ................................................................................146
18.7Modes of Operation .............................................................................................147
18.8Timer/Counter Timing Diagrams .........................................................................151
18.9Asynchronous Operation of Timer/Counter2 .......................................................153
18.10Timer/Counter Prescaler ...................................................................................154
18.11Register Description ..........................................................................................156
19 SPI – Serial Peripheral Interface ......................................................... 164
19.1Features ..............................................................................................................164
19.2Overview .............................................................................................................164
19.3SS Pin Functionality ............................................................................................169
19.4Data Modes .........................................................................................................169
19.5Register Description ............................................................................................171
20 USART0 ................................................................................................. 174
20.1Features ..............................................................................................................174
20.2Overview .............................................................................................................174
20.3Clock Generation .................................................................................................175
20.4Frame Formats ....................................................................................................178
20.5USART Initialization ............................................................................................180
20.6Data Transmission – The USART Transmitter ....................................................181
20.7Data Reception – The USART Receiver .............................................................184
20.8Asynchronous Data Reception ............................................................................188
20.9Multi-processor Communication Mode ................................................................191
20.10Register Description ..........................................................................................193
20.11Examples of Baud Rate Setting ........................................................................197
21 USART in SPI Mode ............................................................................. 202
21.1Features ..............................................................................................................202
21.2Overview .............................................................................................................202
21.3Clock Generation .................................................................................................202
21.4SPI Data Modes and Timing ...............................................................................203
iv ATmega48P/88P/168P
8025M–AVR–6/11