Embedded Systems - IO Programming
In 8051, I/O operations are done using four ports and 40 pins. The following pin diagram shows the details
of the 40 pins. I/O operation operation port reserves reserves 32 pins where each port has 8 pins. The other 8 pins are
designated as V , GND, XTAL1, XTAL2, RST, EA (bar), ALE/PROG (bar), and PSEN (bar).
It is a 40 Pin PDIP (Plastic Dual Inline Package)
I/O Ports and their Functions
The four ports P0, P1, P2, and P3, each use 8 pins, making them 8-bit ports. Upon RESET, all the ports
are configured onfigured as inputs, inputs, ready to be used as input ports. When the first 0 is written written to a port, it becomes becomes
an output. To reconfigure it as an input, a 1 must be sent to a port.
Port 0 (Pin No 32 – Pin No 39)
Dual Role of Port 0 and Port 2