Hardware manual

Table of Contents
2 Atmel 8051 Microcontrollers Hardware Manual
4316A–8051–01/04
2.5 Port Structures and Operation ................................................................2-23
2.5.1 I/O Configurations............................................................................2-23
2.5.2 Writing to a Port...............................................................................2-24
2.5.3 Port Loading and Interfacing ............................................................2-26
2.5.4 Read-Modify-Write Feature ..............................................................2-26
2.6 Accessing External Memory ...................................................................2-27
2.7 PSEN ......................................................................................................2-28
2.8 ALE .........................................................................................................2-28
2.8.1 Overlapping External Program and Data Memory Spaces...............2-29
2.8.2 ALE Disable Mode............................................................................2-29
2.9 Timer/Counters .......................................................................................2-30
2.9.1 Timer/Counter Operations ................................................................2-30
2.10 Timer 0....................................................................................................2-30
2.10.1 Mode 0 (13-bit Timer).......................................................................2-31
2.10.2 Mode 1 (16-bit Timer).......................................................................2-31
2.10.3 Mode 2 (8-bit Timer with Auto-Reload).............................................2-32
2.10.4 Mode 3 (Two 8-bit Timers) ...............................................................2-32
2.11 Timer 1....................................................................................................2-32
2.11.1 Mode 0 (13-bit Timer).......................................................................2-33
2.11.2 Mode 1 (16-bit Timer).......................................................................2-34
2.11.3 Mode 2 (8-bit Timer with Auto Reload).............................................2-34
2.11.4 Mode 3 (Halt)....................................................................................2-34
2.11.5 Interrupt ............................................................................................2-34
2.11.6 Timer Registers ................................................................................2-35
2.12 Timer 2....................................................................................................2-38
2.12.1 Introduction.......................................................................................2-38
2.12.2 Auto-reload Mode.............................................................................2-39
2.12.3 Programmable Clock-output.............................................................2-39
2.12.4 Timer Registers ................................................................................2-41
2.13 Serial Interface........................................................................................2-43
2.13.1 Baud Rates.......................................................................................2-45
2.13.2 Baud Rate Selection Table for UART...............................................2-46
2.13.3 Internal Baud Rate Generator (BRG) ...............................................2-46
2.13.4 Using Timer 1 to Generate Baud Rates ...........................................2-48
2.13.5 Using Timer 2 to Generate Baud Rates ...........................................2-48
2.13.6 More About Mode 0 ..........................................................................2-50
2.13.7 More About Mode 1 ..........................................................................2-51
2.14 Framing Error Detection..........................................................................2-53
2.15 Automatic Address Recognition..............................................................2-54