MICROCONTROLLER-
8051
Features & Applications
Overview
Introduction
Block Diagram and Pin
Description of the 8051
Registers
Memory mapping in 8051
Stack in the 8051
I/O Port Programming
Timers
Interrupts &
Applications
Why do we need to learn
Microcontrollers ?
Its not an exaggeration if I say that ,today
there is no electronic gadget on the earth
which is designed without a
Microcontroller. Ex: communication
devices, digital entertainment, portable
devices etc…
Not believable ??? See the next
slide
Personal information products: Cell phone,
pager, watch, pocket recorder, calculator
Laptop components: mouse, keyboard,
modem, fax card, sound card, battery
charger
Home appliances: door lock, alarm clock,
thermostat, air conditioner, TV remote,
VCR, small refrigerator, exercise
equipment, washer/dryer, microwave oven
Industrial equipment:
Temperature/pressure controllers,
Counters, timers, RPM Controllers
Toys: video games, cars, dolls, etc.
So, A good designer should always know
what type of controller he/she is using ,
their architecture, advantages ,
disadvantages ,
ways to reduce production costs
and product reliability etc….
O.K ????
Then What is a
Microcontroller ?
A smaller computer
On-chip RAM, ROM, I/O ports...
Example : Motorola’s 6811, Intel’s 8051,
Zilog’s Z8 and PIC 16X
CPU RAM ROM
A single chip
Serial
I/O Timer COM Microcontroller
Port
Port
How is it different from a
Microprocessor ??
General-purpose microprocessor
CPU for Computers
No RAM, ROM, I/O on CPU chip
itself
Example : Intel’s
Datax86,
Bus
CPU
Motorola’s 680x0
General-
Serial
Purpose RAM ROM I/O Timer COM
Micro- Port
Port
processor
Address Bus
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and
ROM, I/O, timer are separate timer are all on a single chip
designer can decide on the • fix amount of on-chip ROM,
amount of ROM, RAM and RAM, I/O ports
I/O ports. • Highly bit addressable
expansive • for applications in which cost,
versatility power and space are critical
general-purpose • single-purpose
EVOLUTION
Flashback !!!!
In the year 1976, Motorola created a
Microprocessor chip called 6801 which
replaced its brother 6800 with certain add-
on chips to make a computer. This paved
the way for the new revolution in the history
of chip design and gave birth to a new
entity called
MICROCONTROLLER.
The INTEL bagged the credit of producing
the first Microcontroller 8048 with a CPU
and 1K bytes of EPROM, 64 Bytes of RAM,
an 8-Bit Timer and 27 I/O pins - in 1976.
Evolution
contd…
Then followed the most popular
controller 8051 in the year 1980
with 4K bytes of ROM,128 Bytes of
RAM , a serial port, two 16-bit Timers
, and 32 -I/O pins.
The 8051 family has many additions
and improvements over the years
and remains a most sought-after tool
for today's circuit designers.
The same INTEL introduced a 16 bit
controller 8096 in the year 1982
Later INTEL introduced - 80c196 series of
16-bit microcontrollers mainly for
industrial applications
Microchip (another company ) has
introduced an 8-bit microcontroller PIC
16C64 in 1985.
32-bit microcontrollers have been developed by
IBM
and Motorola
MPC 505 is a 32-bit RISC controller of
Motorola
403 GA is a 32 -bit RISC embedded controller of
IBM
ARM Controllers
In recent times ARM company
(Advanced Risc machines) has
developed and introduced
32 bit controllers - which are
high-end application devices
catering to the need of
communication devices like
mobiles , iPods etc..(Refer
[Link])
Types of Microcontrollers
Microcontrollers from different
•Atmel
manufacturers•Motorola
•ARM •8-bit
•Intel •68HC05
•8-bit •68HC08
•8XC42 •68HC11
•MCS48 •16-bit
•MCS51 •68HC12
•8xC251 •68HC16
•16-bit •32-bit
•MCS96 •683xx
•MXS296 •Texas Instruments
•National •TMS370
Semiconductor
•COP8 •MSP430
•Microchip •Zilog
•12-bit instruction PIC •Z8
•14-bit instruction PIC •Z86E02
• PIC16F84
•16-bit instruction PIC
•NEC
MCS-51 “Family” of
Microcontrollers
Feature 8031 8051 8052
8751
ROM NO 4kB 8kB 4kB UV
EPROM
RAM (Bytes) 128 128 256
128
TIMERS 2 2 3 2
I/O PINS 32 32 32 32
SERIAL PORTS 1 1 1 1
INTERRUPT 6 6 8 6
SOURCES
Microcontroller
Architectures
Memory
0
Address Bus
Program
CPU Data Bus + Data Von Neumann
2n
Architecture
Memory
0
Address Bus
Program
CPU Fetch Bus Harvard
Address Bus 0
Architecture
Data Bus Data
Harvard Architecture
Harvard Architecture refers to a
memory structure where the
processor is connected to two
different memory banks via two
sets of buses.
This is to provide the processor
with two distinct data paths, one
for instruction and one for data.
Harvard Architecture --
continues
Through this scheme, the CPU can
read both an instruction and data
from the respective memory banks
at the same time
This inherent independence
increases the throughput of the
machine by enabling it to prefetch
the next instruction - always
Von-Neumann Machine
A Von-Neumann Machine, in contrast
to the Harvard Architecture provides
one data path (bus) for both instruction
and data
As a result, the CPU can either be
fetching an instruction from memory,
or read/writing data to it.
Other than less complexity of hardware,
it allows for using a single, sequential
memory.
Modern Processors
Modern processors employ a
Harvard Architecture to read
from two
instruction and data cache
memories
and at the same time use a
Von-Neumann Architecture
to access from external
memory.
Important Features of
8051
4K bytes ROM
128 bytes RAM
Four 8-bit I/O ports
Two 16-bit timers
Serial interface
64K external code memory space
64K data memory space
“Original” 8051
Microcontroller
Oscillator 4096 Bytes 128 Bytes Two 16 Bit
and timing Program Memory Data Memory Timer/Event
(ROM) (RAM) Counters
8051 Internal data bus
CPU
64 K Byte Bus Programmable Programmable
Expansion I/O Serial Port Full
Control Duplex UART
Synchronous Shifter
subsystem interrupts
External interrupts Control Parallel ports Serial Output
Address Data Bus Serial Input
I/O pins
Pin Description of the 8051
The 8051 is a 40
pin device, but
out of these 40
pins, 32 are used
for I/O.
24 of these play
dual purpose, i.e.
they can operate
as I/O or as a
control line or as
part of address
or data bus.
8051 CPU
Registers
A (8-bit Accumulator)
B (8-bit register for Mul &Div)
PSW (8-bit Program Status Word)
SP (8-bit Stack Pointer)
PC (16-bit Program Counter)
DPTR (16-bit Data Pointer)
Special Function Registers
DATA registers
CONTROL registers
•Timers
•Serial ports
•Interrupt system
•Analog to Digital converter Addresses 80h – FFh
•Digital to Analog converter
etc.. Direct Addressing is used to
access SFRs
List of Registers
(*Denotes the SFRs)
Contd…
PSW REGISTER
Memory mapping in 8051
ROM memory map in
8051 family
4k 8k 32k
0000H 0000H 0000H
0FFFH
DS5000-32
1FFFH
8051
8752 7FFFH
from Atmel from Dallas
Corporation Semiconductor
RAM memory space allocation
in the 8051
(8 x 4) + 16 + 80 = 128 BYTES
7FH
Scratch pad RAM
80
30H Bytes
2FH
16 Bytes – Also Bit-Addressable RAM
16 x 8 =
20H 128Bits
1FH 8 Bytes Register Bank 3
18H
17H 8 Bytes Register Bank 2
10H
0FH 8 Bytes Register Bank 1 )Stack(
08H
07H 8 Bytes Register Bank 0
00H
Applications of
Microcontrollers
Simple Interfacing
Examples
Seven segment
Interfacing
Traffic light controller
Closed loop control system-
Temperature control
example
Recent
Wonders
Recent Wonders
contd ........
Microcontrollers & embedded
systems
Books for reference & study
1) Barr, Michael, Programming embedded
systems in C and C++ - OReilly Publ.
2) Raj Kamal, Embedded systems, TMG
3) Mazidi and Mazidi, The 8051
microcontroller and embedded systems
- Pearson education.
4) Peatman,J.B. Design with
microcontrollers and microcomputers,
McGraw Hil
5) Sewart. J.W. The 8051
Microcontroller Hardware, Software
and Interfacing – Prentice Hall
6) Ayala Kenneth, The 8051
Microcontroller – Architecture,
Programming and Applications –
Delmar Publ.
7) Ajay Deshmukh, Microcontrollers –
TATA McGraw Hill
8) Rajkamal, Microcontrollers -
Architecture, Programming – Pearson
Publ.
9) Myke Predko, Programming the 8051
Microcontroller – McGraw Hill
10) Michael J. Pont, Embedded C -
Addison Wesley Publ.
Useful websites
Useful websites
contd…
1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. http://
[Link]
6. http://
[Link]
Epilogue
The woods are lovely, dark and
deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.
---- Robert Frost
GOOD LUCK!
THANK YOU