8051 Presentation
8051 Presentation
8051 Presentation
Contents:
Introduction
Block Diagram and Pin Description of the 8051
Registers
Memory mapping in 8051
Stack in the 8051
I/O Port Programming
Timer
Interrupt
Why do we need to learn
Microprocessors/controllers?
The microprocessor is the core of
computer systems.
Nowadays many communication, digital
entertainment, portable devices, are
controlled by them.
A designer should know what types of
components he needs, ways to reduce
production costs and product reliable.
The necessary tools for a
microprocessor/controller
CPU: Central Processing Unit
I/O: Input /Output
Bus: Address bus & Data bus
Memory: RAM & ROM
Timer
Interrupt
Serial Port
Parallel Port
Microprocessors:
General-purpose microprocessor
CPU for Computers
No RAM, ROM, I/O on CPU chip itself
Example : Intel’s x86, Motorola’s 680x0
CPU
Bus Serial
4 I/O Ports
OSC Control Port
P0 P1 P2 P3 TxD RxD
Address/Data
Pin Description of the 8051
(
8
R
0
D
5
)
1
P
3
.
7
Pins of 8051 ( 1/4 )
Vcc ( pin 40 ):
– Vcc provides supply voltage to the chip.
– The voltage source is +5V.
10 uF 31
EA/VPP
30 pF X1
19
11.0592 MHz
8.2 K
X2
18
30 pF
9 RST
Pins of 8051 ( 3/4 )
TB1
Read pin P0.x
8051 IC
Writing “1” to Output Pin P1.X
TB1
Read pin
8051 IC
Writing “0” to Output Pin P1.X
TB1
Read pin
8051 IC
Reading “High” at Input Pin
1 1 P1.X pin
Internal CPU bus D Q
P1.X
0 M1
Write to latch Clk Q
TB1
Read pin
3. Read pin=1 Read latch=0
Write to latch=1
8051 IC
Reading “Low” at Input Pin
TB1
Read pin
3. Read pin=1 Read latch=0
Write to latch=1
8051 IC
Other Pins
P1, P2, and P3 have internal pull-up resisters.
– P1, P2, and P3 are not open drain.
P0 has no internal pull-up resistors and does not
connects to Vcc inside the 8051.
– P0 is open drain.
– Compare the figures of P1.X and P0.X.
However, for a programmer, it is the same to program
P0, P1, P2 and P3.
All the ports upon RESET are configured as output.
A Pin of Port 0
Read latch
TB2
TB1
Read pin P1.x
8051 IC
Port 0 with Pull-Up Resistors
Vcc
10 K
P0.0
DS5000 P0.1
Port 0
P0.2
8751 P0.3
8951 P0.4
P0.5
P0.6
P0.7
Port 3 Alternate Functions
P3 Bit Function Pin
P3.0 RxD 10
P3.1 TxD 11
P3.2 INT0 12
P3.3 INT1 13
P3.4 T0 14
P3.5 T1 15
P3.6 WR 16
P3.7 RD 17
RESET Value of Some 8051 Registers:
R0
DPTR DPH DPL
R1
R2 PC PC
R3
R5
R6
R7
4k 8k 32k
0000H 0000H 0000H
0FFFH
DS5000-32
1FFFH
8751
AT89C51
8752
AT89C52 7FFFH
7FH
30H
2FH
Bit-Addressable RAM
20H
1FH Register Bank 3
18H
17H
Register Bank 2
10H
0FH Stack) Register Bank 1)
08H
07H
Register Bank 0
00H
Stack in the 8051
The register used to access 7FH
the stack is called SP (stack
Scratch pad RAM
pointer) register.
30H
EA : Global enable/disable.
--- : Undefined.
ET2 :Enable Timer 2 interrupt.
ES :Enable Serial port interrupt.
ET1 :Enable Timer 1 interrupt.
EX1 :Enable External 1 interrupt.
ET0 : Enable Timer 0 interrupt.
EX0 : Enable External 0 interrupt.