0% found this document useful (0 votes)
28 views25 pages

8051 Microcontroller

Microprocessor pdf

Uploaded by

himu11248
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views25 pages

8051 Microcontroller

Microprocessor pdf

Uploaded by

himu11248
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

8051 Microcontroller

Microcontroller

• A smaller computer
on a CHIP
• On-chip RAM, ROM,
I/O Ports, Timer,
Serial Controller…
• Example: Motorola’s 2

6811, Intel’s 8051,


Atmel 32

8051
Microcontroller
8051 CPU
Operation
1. Features
2. Pin Diagram
3. Block Diagram

8051 Microcontroller Suresh.P.Nair , HOD - ECE , RCET 3


8051
Microcontroller
• Intel introduced 8051, referred as MCS-
51, in 1981.

• The 8051 is an 8-bit processor


• The CPU can work on only 8 bits of
data at a time

• The 8051 became widely popular after


allowing other manufactures to make and
market any flavor of the 8051.

8051 Microcontroller Suresh.P.Nair , HOD - ECE , RCET 4


Features of 8051
• 8 bit Processor
• 4KB Internal ROM
• 128 Bytes Internal RAM
• Four 8 BIT I/O PORTS (32 I/O LINES)
• Two 16 Bit Timers/Counters
• On Chip Full Duplex UART for Serial Communication
• 5 Vector Interrupts ( 2 External, 3 Internal - Timer0,Timer1,Serial)
• On Chip Clock Oscillator
• 16 bit Address bus
• 64k External Code Memory
• 64k External Data Memory
• 16-bit program counter to access external Code Memory and
• 16 bit Data Pointer to access external Data Memory
• 128 user defined flags
• 32 General Purpose Registers each of 8 bits

8051 Microcontroller 5
Pin Diagram

8051 Microcontroller 6
Pin Description of the
8051

8051 Microcontroller 7
XTAL1 and XTAL2
• The 8051 has an on-chip oscillator but requires an external crystal 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
• The original 8051 operates at 12 MHZ

8051 Microcontroller 8
RST
• 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

8051 Microcontroller 9
EA’
• EA’, “external access’’, is an input pin and must be connected to Vcc
or GND

• The 8051 family members all come with on-chip ROM to store
programs and also have an external code and data memory.

• Normally EA pin is connected to Vcc (Internal Access)

• EA pin must be connected to GND to indicate that the code or data is


stored externally.

8051 Microcontroller 10

Suresh.P.Nair , HOD - ECE , RCET


PSEN’ and ALE
• PSEN, “program store enable’’, is an output pin

• This pin is connected to the OE pin of the external memory.

• For External Code Memory, PSEN’ = 0

• For External Data Memory, PSEN’ = 1

• ALE pin is used for demultiplexing the address and data.

8051 Microcontroller 11
I/O Port Pins
• The four 8-bit I/O ports P0, P1,
P2 and P3 each uses 8 pins.

• All the ports upon RESET are


configured as output, ready to
be used as input ports by the
external device.

8051 Microcontroller Suresh.P.Nair , HOD - ECE , RCET 12


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.

• ALE indicates if P0 has address or data.


• When ALE=0, it provides data D0-D7
• When ALE=1, it has address A0-A7

8051 Microcontroller 13
Port 1 and Port 2
• In 8051-based systems with no external
memory connection:
• Both P1 and P2 are used as simple I/O.
• In 8051-based systems with external
memory connections:
• Port 2 must be used along with P0 to provide the
16-bit address for the external memory.
• P0 provides the lower 8 bits via A0 – A7.
• P2 is used for the upper 8 bits of the 16-bit
address, designated as A8 – A15, and it cannot
be used for I/O.

8051 Microcontroller 14

Suresh.P.Nair , HOD - ECE , RCET


Port 3
• Port 3 can be used as input or
output.

• Port 3 has the additional


function of providing some
extremely important signals

8051 Microcontroller 15

Suresh.P.Nair , HOD - ECE , RCET


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
8051 Microcontroller
serves special features as explained. 16
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
8051 Microcontroller programming. (applies for 89c5x MCU's) 17

Suresh.P.Nair , HOD - ECE , RCET


General Block Diagram of 8051

Interrupt 4K 128 B Timer 0


Control ROM RAM Timer 1

CPU

Bus Serial
OSC 4 I/O Ports
Control Port

TXD RXD
P0 P1 P2 P3
8051 Peripheral Overview

SERIAL PORT INTERRUPTS


8051 Microcontroller Suresh.P.Nair , HOD - ECE , RCET 20
8051 Serial Port
• Synchronous and Asynchronous
• SCON Register is used to Control
• Data Transfer through TXd & RXd pins
• Some time - Clock through TXd Pin

Four Modes of Operation:

Mode 0 :Synchronous Serial Communication


Mode 1 :8-Bit UART with Timer Data Rate
Mode 2 :9-Bit UART with Set Data Rate
Mode 3 :9-Bit UART with Timer Data Rate

8051 21
Microcontroller
8051 Interrupts

8051 Microcontroller 22
Six Interrupts in 8051
Six interrupts are allocated as follows:

1.Reset – power-up reset.

2.Two interrupts are set aside for the timers.


• one for timer 0 and one for timer 1

3.Two interrupts are set aside for hardware external interrupts.


• P3.2 and P3.3 are for the external hardware interrupts INT0 (or
EX1), and INT1 (or EX2)

4.Serial communication has a single interrupt that belongs to both


receive and transfer.

8051 Microcontroller 23
8051 Microcontroller 24
Steps in Executing an Interrupt
1. It finishes the instruction it is executing and
saves the address of the next instruction
(PC) on the stack.
2. It also saves the current status of all the
interrupts internally (i.e: not on the stack).
3. It jumps to a fixed location in memory,
called the interrupt vector table, that
holds the address of the ISR.
4. The microcontroller gets the address of the
ISR from the interrupt vector table and
jumps to it.
5. It starts to execute the interrupt service
subroutine until it reaches the last
instruction of the subroutine which is RETI
(return from interrupt).
6. Upon executing the RETI instruction, the
microcontroller returns to the place 25
where it was interrupted.

You might also like