I/O Ports
ü The 8051 contains four I/O ports
ü All four ports are bidirectional
ü Each port has SFR (Special Function Registers P0 through P3) which works like a latch, an output driver and an input buffer
ü Both output driver and input buffer of Port 0 and output driver of Port 2 are used for accessing external memory
ü Accessing external memory works like this
1. Port 0 outputs the low byte of external memory address (which is time- multiplexed with the byte being written or read)
2. Port 2 outputs the high byte (only needed when the address is 16 bits wide)
ü Port 3 pins are multifunctional
ü The alternate functions are activated with the 1 written in the corresponding bit in the port SFR
Table 4.3 Alternate Functions of Port 3 pins
Serial Communication
Some of the external I/0 devices receive only the serial data. Normally serial communication is used in the Multi-Processor environment.8051 has two pins for serial communication.
ü SID- Serial Input data.
ü SOD-Serial Output data.
Interrupt Structure
ü The 8051 provides 4 interrupt sources
ü Two external interrupts
ü Two timer interrupts
Port Structure
ü The 8051 contains four I/O ports
ü All four ports are bidirectional
ü Each port has SFR (Special Function Registers P0 through P3) which works like a latch, an output driver and an input buffer
ü Both output driver and input buffer of Port 0 and output driver of Port 2 are used for accessing external memory
ü Accessing external memory works like this
ü Port 0 outputs the low byte of external memory address (which is time- multiplexed with the byte being written or read)
ü Port 2 outputs the high byte (only needed when the address is 16 bits wide)
ü Port 3 pins are multifunctional