PARALLEL PORTS


Parallel Ports of 8051

8051 has 4 I/O ports: Port 0, Port 1, Port 2, and Port 3. The microcontroller has limited pin count, so pins of the parallel ports are also used for alternate functions.

Port 1 is used only for input and output functions.

The other ports (Port 0, Port 2, Port 3) have distinct functions in addition to input/output. These ports can perform two different functions based on the commands or programs running.

All four ports are bi-directional and can be programmed as input or output. Each port pin is



 connected through an 8-bit D-type latch. The latch connects the data to the port pin when used as output.

All four ports can be accessed using addresses mapped in the Special Function Register (SFR) area. Each bit of the ports can be accessed using bit addresses, allowing individual bits to be read or changed.


20003.1 8051 I/O Ports Structure

The 8051 has four 8-bit parallel ports (P0, P1, P2, P3) providing 32 I/O pins. All four ports are bidirectional, meaning each pin can be configured as input, output, or both. All ports are multiplexed except Port 1.


Port 0 (Pins 32–39)

  • Used as a multiplexed address/data bus for external memory.
  • Outputs the low-order byte of the external memory address, time-multiplexed with data.
  • Can be used to access external memory.



Port 1 (Pins 1–8)

  • Used only as I/O pins.
  • Not multiplexed.



Port 2 (Pins 21–28)

  • Outputs the high-order byte of the external memory address when the address is 16 bits wide.
  • Otherwise, works as I/O port.



Port 3 (Pins 10–17)

  • Each pin has an alternate function along with I/O.
  • Special functions include external interrupts, counter inputs, serial communication, and control signals.


Pin Symbol Position Alternate Use
RD P3.7 External memory read signal
WR P3.6 External memory write signal
T1 P3.5 External timer 1 input
T0 P3.4 External timer 0 input
INT1 P3.3 External interrupt 1 input
INT0 P3.2 External interrupt 0 input
TXD P3.1 Serial data transmit
RXD P3.0 Serial data receive













Refer