Subject: Advanced microprocessors & microcontrollers Unit: V Topic:

pleasanthopebrothersΗλεκτρονική - Συσκευές

2 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

102 εμφανίσεις

microprocessors &


Introduction to 8051

Electronics &


Introduction to 8051 family architecture

Pin diagram and operation


Addressing modes

Internal & external memory

Special function registers

Flag organization

Counters & timers

Learning objectives

Introduce 8051 microcontroller

Its advantages


Every minor detail to be covered given in the

Introduction to 8051

Microcomputer on a single chip of silicon

Embedded system

Developed by Intel in 1980

40 pin IC

32 I/O lines, 128 X 8 bit internal RAM, 4K X 8
ROM , etc


In household appliances like TV, DVD, washing
machine, etc

In office automation industry

Consumer electronics goods

Used in communication and automobile market

In handheld battery operated devices

8051 Architecture


Arithmetic and logic unit

Accumulator (8 bit)

Register B (8 bit)

Program status word (8 bit)

Stack pointer (8 bit)

Program counter (16 bit)

DPTR (16 bit)


Serial data buffer: Transmit and receive buffer

Timer registers: TL0,TL1,TH0,TH1

Control registers: IP, IE, TMOD, TCON, SCON,

Timing and control unit


Instruction register

Special function registers

Pin diagram


Four ports viz; Port0, Port1, Port2, Port3

All I/O pins are bidirectional

Port 1,2 and 3 have internal pull ups

Port 0 has open drain outputs, hence need
external pull ups

Port 0,2 and 3 are dual purpose

Port 1 is dedicated I/O port

Addressing modes

8051 supports 5 types of addressing

Immediate addressing mode

Direct addressing mode

Indirect addressing mode

Register addressing mode

Index addressing mode

Immediate addressing mode

8/16 bit data is itself a part of the instruction

# sign is to be used along with the number to
indicate it is a data

E.g. MOV A,#54H

Direct addressing mode

8 bit data is present in some memory location
and that 8 bit memory location is a part of the

It is used to give 8 bit addresses of internal RAM
and SFRs

E.g. MOV R3,65H

Indirect addressing mode

8/16 bit address is present in the register and
that register is used as a pointer to access data

Registers R0 and R1 are used to store 8 bit
address and DPTR is used to store 16 bit

@ is used before the register to indicate address

E.g. MOV R0,#45H


Register addressing mode

8/16 bit address is present in the register and
that register is used in the instruction

E.g. MOV A,B

Index addressing mode

Only program memory can be accessed

Intended for reading look up tables

The exact address I the instruction is formed by
accumulator and DPTR


Internal and external memory

8051 Program memory space

8051 data memory space

Internal RAM of 128 bytes

Register banks(32 bytes)

Bit addressable locations

General purpose locations

Flag organization

CY: carry flag

AC: auxiliary carry flag

F0: available as general purpose bit

RS1 & RS0: for selection of bank 0,1,2 and 3

OV: overflow flag

P: parity flag

Special function registers

Parallel ports



Serial ports

Power saving modes

Parallel ports

Interrupt Enable register (IE)

EA: If EA=1, enable interrupts and if EA=0
disable all interrupts

ES: enable or disable serial port interrupt

ET1: enable or disable timer1 overflow interrupt

EX1: enable or disable external interrupt 1

ET0: enable or disable timer0 overflow interrupt

EX0: enable or disable external interrupt 0

Interrupt priority register (IP)

PS: priority of serial port

PT1: priority of timer1 overflow interrupt

PX1: priority of external interrupt 1

PT0: priority of timer0 overflow interrupt

PX0: priority of external interrupt 0

TCON register

TCON register

IE1: external interrupt 1 edge flag

IT1: interrupt 1 type control bit

IE0: external interrupt 0 edge flag

IT0: interrupt 0 type control bit

Timers and Counters

8051 has two timers named timer0 and timer1

Each 16 bit timer can be used as two 8 bit timers

Timer register increments after every negative
edge input of the CLK

Timer register can only increment, hence it is an
up counter

Timers and Counters

For timer C/ T=0 and internal clock is used

For counter C/ T=1 and external clock is used

The operation is controlled by two registers

TMOD register

GATE: if GATE=0 then software controlled, if 1
then hardware controlled

C/ T: if 0 then timer if 1 then counter

M1 M0: for modes 0,1,2 and 3


SCON (serial port control


SM2: if 1 enable multiprocessor communication.
Normally 0.

SM0 and SM1: for modes 0,1,2 and 3

REN: for enable and disable reception

TB8: transmitted 9

bit will be stored

RB8: received 9

bit will be stored

TI: transmit interrupt flag

RI: receive interrupt lag

PCON register

SMOD: if 1 the baud rate is doubled

GF1: general purpose flag bit

GF0: general purpose flag bit

PD: power down bit

IDL: idle mode bit


The 8051 architecture is explained having
different 8 bit registers and two 16 bit registers
viz; DPTR and PC.

40 pin IC, four ports and 5 different addressing
modes have been explained.

The memory is divided as internal and external
memory of 64k each.

Internal RAM of 128 bytes is present.

8 bit Flag register and special function registers
like TMOD,TCON,PCON, etc have been


The 8051 microcontroller and embedded
systems by Mazidi.

The 8051 microcontroller by Kenneth Ayala

Design with PIC microcontrollers by John B.