8051 Microcontroller
8051 Microcontroller
2
The 8051 microcontroller is a very popular 8-bit microcontroller
introduced by Intel in the year 1981.
4
What is Microcontroller?
Micro Controller
5
Microcontroller
• A smaller computer
• On-chip RAM, ROM, I/O ports...
• Example: Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and
PIC
6
7
8
Microprocessor Microcontroller
9
The necessary tools for a Microprocessor/controller
10
Bus: Address bus & Data bus
3
Timer
5
11
Interrupt
6
Serial Port 7
Parallel Port
8
12
Features
8 bit microcontroller originally
developed by Intel in 1980
High-performance CMOS
Technology
40 pin DIP IC
14
Features
Address bus is of 16 bit & data
bus is of 8 bit
15
Features
It has four 8 bit ports, total 32
I/O lines
16
Features
64K external code & data
memory space
17
8051 Family
The 8051 is a subset of the 8052
The 8031 is a ROM-less
17
18
ARCHITECTURE
19
20
8051
Pin diagram:-
21
22
XTAL2 and XTAL1 (18 and 19 pins)
The 8051 has an on-chip oscillator but requires an external
clock to run it
A quartz crystal oscillator is connected to inputs XTAL1
(pin19) and XTAL2 (pin18)
The quartz crystal oscillator also needs two capacitors of
30 pF value
23
RST (Pin 9)
RESET pin is an input and is active high (normally low)
Upon applying a high pulse to this pin, the
microcontroller will reset and terminate all activities
This is often referred to as a power-on reset
Activating a power-on reset will cause all values in the
registers to be lost
24
EA (pin 31) : external access
EA “external access’’, is an input pin and must be
connected to Vcc or GND
26
27
I/O Port Pins
• The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8
pins.
28
Port 0
Port 0 is also designated as AD0-AD7.
When connecting an 8051 to an external
memory, port 0 provides both address and
data.
The 8051 multiplexes address and data
through port 0 to save pins.
31
Pin Description Summary
PIN TYPE NAME AND FUNCTION
Vss I Ground: 0 V reference.
Vcc I Power Supply: This is the power supply voltage for normal, idle, and
power-down operation.
P0.0 - P0.7 I/O Port 0: Port 0 is an open-drain, bi-directional I/O port. Port 0 is also the
multiplexed low-order address and data bus during accesses to external
program and data memory.
P1.0 - P1.7 I/O Port 1: Port I is an 8-bit bi-directional I/O port.
P2.0 - P2.7 I/O Port 2: Port 2 is an 8-bit bidirectional I/O. Port 2 emits the high order
address byte during fetches from external program memory and during
accesses to external data memory that use 16 bit addresses.
P3.0 - P3.7 I/O Port 3: Port 3 is an 8 bit bidirectional I/O port. Port 3 also serves special
features as explained.
32
Pin Description Summary
PIN TYPE NAME AND FUNCTION
RST I Reset: A high on this pin for two machine cycles while the oscillator is
running, resets the device.
ALE O Address Latch Enable: Output pulse for latching the low byte of the address
during an access to external memory.
PSEN O Program Store Enable: The read strobe to external program memory. When
executing code from the external program memory, PSEN* is activated
twice each machine cycle, except that two PSEN* activations are skipped
during each access to external data memory.
EA/VPP I External Access Enable/Programming Supply Voltage: EA must be externally
held low to enable the device to fetch code from external program memory
locations. If EA* Is held high, the device executes from internal program
memory. This pin also receives the programming supply voltage Vpp
during Flash programming. (applies for 89c5x MCU's)
33
Registers
A
R0
DPTR DPH DPL
R1
R2 PC PC
R3
R5
R6
R7
34
Program Status Word [PSW]
C AC F0 RS1 RS0 OV F1 P
Carry Parity
Auxiliary Carry User Flag 1
35
8051 ROM
36
8051 RAM with
addresses
37
8051 Peripheral
1. Timers
2. Serial Port
3. Interrupts
38
Advantage Disadvantage
39
Application
40
LED INTERFACING
41
7 SEGMENT INTERFACING
42
APPLICATION OF 8051
Automobile.
Rail Transport.
Industrial Processing.
Remote sensing.
Robotics.
Consumer electronics.
Security(e-commerce and smart cards).
Medical.
Defense application.
43
Project
44
Water Level Controller using
8051 Microcontroller
45
Thank you for your time and attention.
46