8051 Notes 5 - Pin configuration & input output ports
8051 Notes 5 - Pin configuration & input output ports
• Pins 1 to 8 − These pins are known as Port 1. This port doesn’t serve any
other functions. It is internally pulled up, bi-directional I/O port.
• Pin 9 − It is a RESET pin, which is used to reset the microcontroller to its
initial values.
• Pins 10 to 17 − These pins are known as Port 3. This port serves some
functions like interrupts, timer input, control signals, serial communication
signals RxD and TxD, etc.
• Pins 18 & 19 − These pins are used for interfacing an external crystal to get
the system clock.
• Pin 20 − This pin provides the power supply to the circuit.
• Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port. Higher
order address bus signals are also multiplexed using this port.
• Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used
to read a signal from the external program memory.
• Pin 30 − This is EA pin which stands for External Access input. It is used to
enable/disable the external memory interfacing.
• Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used
to demultiplex the address-data signal of port.
• Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port. Lower
order address and data bus signals are multiplexed using this port.
• Pin 40 − This pin is used to provide power supply to the circuit.
• Pin configuration, i.e. the pin can be configured as 1 for input and 0 for
output as per the logic state.
o Input/Output (I/O) pin − All the circuits within the microcontroller
must be connected to one of its pins except P0 port because it does
not have pull-up resistors built-in.
o Input pin − Logic 1 is applied to a bit of the P register. The output FE
transistor is turned off and the other pin remains connected to the
power supply voltage over a pull-up resistor of high resistance.
• Port 0 − The P0 (zero) port is characterized by two functions −
o When the external memory is used then the lower address byte
(addresses A0A7) is applied on it, else all bits of this port are
configured as input/output.
o When P0 port is configured as an output then other ports consisting
of pins with built-in pull-up resistor connected by its end to 5V power
supply, the pins of this port have this resistor left out.
Input Configuration
If any pin of this port is configured as an input, then it acts as if it “floats”, i.e.
the input has unlimited input resistance and in-determined potential.
Output Configuration
P1 is a true I/O port as it doesn’t have any alternative functions as in P0, but
this port can be configured as general I/O only. It has a built-in pull-up resistor
and is completely compatible with TTL circuits.
Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy
addresses intended for the external memory chip. This port can be used for
higher address byte with addresses A8-A15. When no memory is added then
this port can be used as a general input/output port similar to Port 1.
Port 3
In this port, functions are similar to other ports except that the logic 1 must be
applied to appropriate bit of the P3 register.