8051 Microcontroller and Interfacing
8051 Microcontroller and Interfacing
Interfacing
Prepared By
Mr.K.Ganesan,
Assistant Professor
Department of Electronics and Communication
Sri Ganesh College of Arts & Science,
Salem - 636014
Microcontroller
• A microcontroller is a compact integrated
circuit designed to govern a specific operation
in an embedded system. A typical
microcontroller includes a processor, memory
and input/output (I/O) peripherals on a single
chip.
8051 Pin Diagram
Pin diagram
• 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.
8051 Architecture
8051 Architecture
• It is 8 bit unit
• Timer/Counter register
• Each register is 16 bit register divide into lower and higher byte register
• 8051 microcontroller has two 8-bit timer control register i.e. TMOD and
TCON register.
TMOD Register:
• It is 8-bit register. Its address is 89H.
• It is byte addressable.
• It used to select mode and control operation of time by writing control word.
TCON register:
• It is 8-bit register. Its address is 88H. It is byte addressable.
• Its MSB 4- bit are used to control operation of timer/ counter and LSB 4-bit
are used for external interrupt control.
Serial data register:
• It is 8-bit register.
• It is byte addressable . Its address is 87H.
• Its bits are used to control mode of power
saving circuit, either idle or power down mode
and
• also one bit is used to modify baud rate of
serial communication.
Program Status Word
PSW
• It is 8 bit register.