Escolar Documentos
Profissional Documentos
Cultura Documentos
8051
OUTLINE
What is microcontroller?
What are different types of microcontroller?
How to select controller for a given application?
8051 internal architecture
8051 pinout & pin description
8051 architecture details
8051 assembly programming
8051 addressing modes
8051 Timer,Interrupt,serial port programming
Intruduction
Microcontroller (uC)
Microcontrollers
Memory
CPU
ROM
RAM
I/O
A single chip
Subsystems:
Timers, Counters, Analog
Interfaces, I/O interfaces
Microcontroller :
MICROPROCESSOR
One or two
instructions for
moving the data
from ext memory
to
CPU.
In C
large number
of pins are multi
functioned.
No Inbuilt timer.
Inbuilt timer is
there.
uCs
RAM/ROM capacity
Common Microcontrollers
Atmel
ARM
Intel
8-bit
8XC42
MCS48
MCS51
8xC251
16-bit
MCS96
MXS296
National Semiconductor
COP8
Microchip
12-bit instruction PIC
14-bit instruction PIC
PIC16F84
16-bit instruction PIC
NEC
Motorola
8-bit
68HC05
68HC08
68HC11
16-bit
68HC12
68HC16
32-bit
683xx
Texas Instruments
TMS370
MSP430
Zilog
Z8
Z86E02
2.
3.
easy to upgrade
Different architectures
One shared memory for instructions (program) and
data with one data bus and one address bus
between processor and memory. Instructions and
data have to be fetched in sequential order (known
as the Von Neumann Bottleneck), limiting the
operation bandwidth.
simpler than that of the Harvard architecture.
mostly used to interface to external memory.
RAM ROM
Serial
Timer COM
Port
A single chip
Microcontroller
Block Diagram
External Interrupts
Interrupt
Control
Timer 1
Timer 2
4k
ROM
128 bytes
RAM
Bus
Control
4 I/O Ports
CPU
OSC
P0 P2 P1
Addr/Data
P3
Serial
TXD RXD
no ROM
mask ROM
EPROM
Flash EEPROM
89xx
8031
80xx
87xx
89xx
8951
8952
8953
8955
898252
891051
892051
Example (AT89C51,AT89LV51,AT89S51)
AT= ATMEL(Manufacture)
C = CMOS technology
LV= Low Power(3.0v)
ROM
RAM
Timer
Int
IO pin
Other
8951
4k
128
32
8952
8k
256
32
8953
12k
256
32
WD
8955
20k
256
32
WD
898252
8k
256
32
ISP
891051
1k
64
16
AC
892051
2k
128
16
AC
Source
8051
Schematic
Pin out
B2
Vcc
Internal
Pull-Up
Internal CPU
bus
Write to latch
Clk
P1.X
pin
P1.X
M1
B1
Read pin
2 Tri-state buffer
A transistor M1 gate
Gate=0: open
Gate=1: close
Vcc
B2
Write to latch
Clk
2. output pin is
Vcc
P1.X
pin
P1.X
B1
Read pin
Internal
Pull-Up
M1
output 1
Vcc
B2
Write to latch
Clk
2. output pin is
ground
P1.X
pin
P1.X
B1
Read pin
Internal
Pull-Up
M1
output 0
1.
Vcc
B2
Clk
Q
0
B1
Read pin
3. Read pin=1 Read latch=0
2. MOV A,P1
external pin=High
P1.X pin
Q
P1.X
Write to latch
Internal
Pull-Up
1
M1
Vcc
Internal
Pull-Up
MOV P1,#0FFH
Internal CPU bus
2. MOV A,P1
B2
P1.X
Write to latch
Clk
M1
B1
Read pin
3. Read pin=1 Read latch=0
8051 IC
external pin=Low
P1.X pin
Important Pins
XTAL2
XTAL1
GND
Machine cycle
Machine Cycle Freq.=1/12 XTAL
Solution:
(a) 11.0592 MHz / 12 = 921.6 kHz;
machine cycle = 1 / 921.6 kHz = 1.085 s
(b) 16 MHz / 12 = 1.333 MHz;
machine cycle = 1 / 1.333 MHz = 0.75 s
Power-On Reset
Vcc
31
10 uF
30 pF
9
10 K
EA/VPP
X1
X2
RST
Reset Value
0000
00
00
00
07
0000
Types of Memory
FFFFh
DATA
Chip 8051
Memory
(up to 64KB)
Internal RAM
SFRs
External
RAM
0000h
FFFFh
External
CODE
Internal code
Memory
Memory
(up to 64KB)
(EEPROM)
0000h
ROM
Types of Memory
4k,8k,12k,20k
Memory Arrays
RAM (Volatile)
Memory Arrays
Bank 3
18
17
Bank 2
10
0F
Bank 1
08
07
06
05
04
03
02
01
00
R7
R6
R5
R4
R3
R2
R1
R0
Bank 0
4 Register Banks
Each bank has R0-R7
Selectable by PSW.2,3
7F
78
2E
2D
2C
2B
2A
29
28
27
26
25
24
23
1A
22
21
20
10
0F
07
08
06
05
04
03
02
01
00
20h 2Fh
(16 locations 8-bits = 128 bits)
Used in assembler
instructions
Registers
SP
A
B
R0
DPTR
DPH
DPL
R1
R2
PC
PC
R3
R4
R5
R6
R7
7FH
Scratch pad RAM
30H
2FH
Bit-Addressable RAM
20H
1FH
18H
17H
10H
0FH
08H
07H
00H
Register Bank 3
Register Bank 2
Register Bank 1( Stack)
Register Bank 0
Review
What is microcontroller?
What are different vendors?
What are factors differentiating uc form each
other?
How to select uc for developing application?
What is there inside 8051?
What are pins of 8051?How they function?