Microcontroladores 8051
Captulo 2:
Prentice Hall
Microcontroladores 8051
Captulo 2:
Arquitetura do 8051
Interrupes Internas
(3) e Externas (2)
Controle de
Interrupes
ROM
RAM
Entradas
externas de
clock dos
Contadores
Timer 0
Timer 1
CPU
OSC
Bar.
Controle
4 Portes de Ent/Sai
P0
P1
P2
Porte Serial
P3
TX
RX
Microcontroladores 8051
Captulo 2:
Dispositivo
Verso sem
ROM
Verso
com
EPROM
8051
8031
8051AH
8031AH
8052AH
8032AH
8751AH
8751BH
8752BH
80C51BH
80C31BH
87C51
80C52
80C32
83C51FA
80C51FA
87C51FA
83C51FB
80C51FA
87C51FB
83C152JA
80C152JA
80C152JB
83C152JC
80C152JC
80C152JD
83C452
80C452
87C452P
Capacidade Capacidade
da ROM
da RAM
Portes
de E/S
de 8 bits
Timers/
Contadores de
16 bits
Matrizes de
contadores
programveis
UART
Canais
de DMA
Canais
A/D
Fontes de
interrupo
4K
4K
128
128
4
4
2
2
X
X
6/5
6/5
8K
4K
8K
8K
16K
8K
8K
8K
256
128
256
256
256
256
256
256
256
256
4
4
4
4
4
5
7
5
7
5
3
2
3
3
3
2
2
2
2
2
X
X
X
X
X
X
X
X
X
X
8/6
6/5
8/6
14/7
14/7
19/11
19/11
19/11
19/11
9/8
X
X
2
2
2
2
Modos de
baixo
consumo e
Idle
X
X
X
X
X
X
X
X
X
Microcontroladores 8051
Captulo 2:
Pinagem do 8051
Entrada do sinal externo de Reset
----9
----18
Reset
X2
EA/
ALE
----31
----30
----19
----39
X1
P0.0/AD0
PSEN/
P2.0/A8
----29
----21
----38
----37
----36
----35
----34
----33
----32
----1
----2
----3
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P1.0
P1.1
P1.2
----22
----23
----24
----25
----26
----27
----28
----10
----11
----12
Bit 3 do porte 1
----4
P1.3
----13
Bit 4 do porte 1
----5
----6
----7
P1.4
P1.5
P1.6
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
/
P3.3/INT1
/
P3.4/T0
P3.5/T1
P3.6/WR/
----14
----15
----16
----8
P1.7
P3.7/RD/
----17
Bit 5 do porte 1
Bit 6 do porte 1
Bit 7 do porte 1
Figura 2:
Pinagem do
8051
Prentice Hall
Microcontroladores 8051
Captulo 2:
Memria de programa e memria de dados
Memria de Programa:
Memria de Dados:
FFFFh
Externa
FFFFh
Externa
Interna
FFh
1000h
0FFFh
PSEN\
EA\=0
Externa
EA\=1
Interna
80h
7Fh
128 bytes
superiores
SFRs
128 bytes
inferiores
00h
0000h
RD\
0000h
WR\
Microcontroladores 8051
Captulo 2:
Endereamento das Interrupes
ROM
07FFh
Timer 2
(8052/32)
:
:
:
:
0033h
0032h
002Bh
Serial Port
002Ah
0023h
Timer 1
0022h
001Bh
Ext. Int. 1
Timer 0
Ext. Int. 0
Reset
001Ah
0013h
0012h
000Bh
000Ah
0003h
8 bytes
0002h
0000h
Microcontroladores 8051
Captulo 2:
8051
P1
ROM/EPROM
OE\=OEbarra
D7-D0
PSENbarra
P0
Latch
ALE
P3
Endereos mais
significativos
P2
EAbarra
Endereos menos
significativo
GND
Prentice Hall
Microcontroladores 8051
Captulo 2:
MCS-51 com ROM
interna
P1
RAM
P0
VCC
D7-D0
Latch
EAbarra
ALE
E/S
RD\ P3
WR\
P2
bits de paginao
E/S
Endereos menos
significativo
Endereos mais
significativos
WE\
OE\
Prentice Hall
Microcontroladores 8051
Captulo 2:
FFh
FFh
7Fh
Acessvel por endereamento
direto e indireto (128 bytes
inferiores)
00h
Prentice Hall
Figura 7:
Memria de
dados interna.
Microcontroladores 8051
10
Captulo 2:
Figura 8: 128
bytes inferiores
da RAM interna.
7Fh
30h
2Fh
20h
1Fh
R7
Banco 3
18h
17h
R0
R7
Banco 2
Valor inicial do SP
(Stack Pointer:
ponteiro de pilha) aps
um sinal de Reset.
10h
0Fh
R0
R7
Banco 1
08h
07h
R0
R7
Banco 0
00Hh
Prentice Hall
Microcontroladores 8051
R0
11
Captulo 2:
Program Status Word
bits
(PSW) =
AC
F0 RS1 RS0 OV
Prentice Hall
Microcontroladores 8051
12
Captulo 2:
Bancos de Registradores
RS1 RS0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Prentice Hall
Endereo
1Fh
1Eh
1Dh
1Ch
1Bh
1Ah
19h
18h
17h
16h
15h
14h
13h
12h
11h
10h
0Fh
0Eh
0Dh
0Ch
0Bh
0Ah
09h
08h
07h
06h
05h
04h
03h
02h
01h
00h
Registrador
R7
R6
R5
R4
R3
R2
R1
R0
R7
R6
R5
R4
R3
R2
R1
R0
R7
R6
R5
R4
R3
R2
R1
R0
R7
R6
R5
R4
R3
R2
R1
R0
Microcontroladores 8051
Banco
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
13
Captulo 2:
Endereamento por bits/bytes
Endereo de Memria
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
2Fh
2Eh
2Dh
2Ch
2Bh
2Ah
29h
28h
27h
26h
25h
24h
23h
22h
21h
20h
7Fh
77h
6Fh
67h
5Fh
57h
4Fh
47h
3Fh
37h
2Fh
27h
1Fh
17h
0Fh
07h
7Eh
76h
6Eh
66h
5Eh
56h
4Eh
46h
3Eh
36h
2Eh
26h
1Eh
16h
0Eh
06h
7Dh
75h
6Dh
65h
5Dh
55h
4Dh
45h
3Dh
35h
2Dh
25h
1Dh
15h
0Dh
05h
7Ch
74h
6Ch
64h
5Ch
54h
4Ch
44h
3Ch
34h
2Ch
24h
1Ch
14h
0Ch
04h
7Bh
73h
6Bh
63h
5Bh
53h
4Bh
43h
3Bh
33h
2Bh
23h
1Bh
13h
0Bh
03h
7Ah
72h
6Ah
62h
5Ah
52h
4Ah
42h
3Ah
32h
2Ah
22h
1Ah
12h
0Ah
02h
79h
71h
69h
61h
59h
51h
49h
41h
39h
31h
29h
21h
19h
11h
09h
01h
78h
70h
68h
60h
58h
50h
48h
40h
38h
30h
28h
20h
18h
10h
08h
00h
Prentice Hall
Microcontroladores 8051
14
Captulo 2:
Registradores de Funes Especiais (SFRs)
Registradores
A ou ACC
B*
DPL
DPH
IE*
IP
SCON*
SBUF
PSW*
PCON
TCON*
TMOD
TH0
TL0
TH1
TL1
P0*
P1*
P2*
P3*
Prentice Hall
Endereo
E0h
F0h
82h
83h
A8h
B8h
98h
99h
D0h
87h
88h
89h
8Ch
8Ah
8Dh
8Bh
80h
90h
A0h
B0h
Microcontroladores 8051
15
Captulo 2:
Registradores de Funes Especiais (SFRs)
para o 8052
Registradores Endereo Nome dos Registradores
T2CON*
C8h
Controle de Timer/Contador 2
TH2
CDh
Byte mais significativo do Timer/Contador 2
TL2
CCh
Byte menos significativo do Timer/Contador 2
RCAP2H
CBh
Byte mais significativo do Timer/Contador de captura 2
RCAP2L
CAh
Byte mais significativo do Timer/Contador de captura 2
* Registradores endereados por bit;
Tabela 2 - Registradores de Funes Especiais.
Prentice Hall
Microcontroladores 8051
16
Captulo 2:
Microcontroladores 8051
17
Captulo 2:
Entradas
Sadas
G2A G2B G1 A2 A1 A0
Y0 Y1 Y2 Y3 Y4 Y5
1
X
X X X X
1
1
1
1
1
1
X
1
X X X X
1
1
1
1
1
1
X
X
0
X X X
1
1
1
1
1
1
0
0
1
0
0
0
0
1
1
1
1
1
0
0
1
0
0
1
1
0
1
1
1
1
0
0
1
0
1
0
1
1
0
1
1
1
0
0
1
0
1
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
1
1
0
1
0
0
1
1
0
1
1
1
1
1
1
0
0
0
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
0: 0 lgico; 1: 1 lgico; X: pode ser 0 ou 1 lgico; : representa entrada ativa em 0 lgico.
Y6
1
1
1
1
1
1
1
1
1
0
1
Microcontroladores 8051
18
Captulo 2:
Prentice Hall
Microcontroladores 8051
19
Captulo 2:
A15
A14
A13
A12
A11
A10
A9
A8
A7
A6
A5
A4
A3
A2
A1
A0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
0
X
1
Prentice Hall
Microcontroladores 8051
Endereo
Inicial e final
0000H
1FFFH
2000H
3FFFH
4000H
5FFFH
6000H
7FFFH
8000H
9FFFH
A000H
BFFFH
C000H
DFFFH
E000H
FFFFH
20
Captulo 2:
Prentice Hall
Microcontroladores 8051
21
Captulo 2:
Prentice Hall
Microcontroladores 8051
22
Captulo 2:
Sinal de relgio:
S1
S2
S3
S4
S5
S6
S1
S2
S3
S4
S5
S6
P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2
Sinal de ALE:
S1
S2
L o prx.
Opcode (descarta)
S3
S4
S5
L o prx.
Opcode novamente
S6
S1
S2
S3
S4
S5
S6
S2
S3
S4
S5
S6
S1
S2
L segundo
Byte
S3
S4
S5
L prox.
Opcode
S6
S1
S1
S2
L prox.
Opcode (descata)
S3
S4
S5
L prox.
Opcode (descarta)
S6
S1
S2
L prox.
Opcode (descarta)
S3
S4
S5
S6
Abaixo os sinais e tempos envolvidos na busca do programa em memria de programa externa em uso da
instruo MOVX.
S1
S2
S3
S4
S5
S6
S1
S2
S3
S4
S5
S6
P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2
Sinal de ALE:
PSEN\ :
RD\:
P2:
PCH Out
P0:
Inst.
in
Prentice Hall
PCH Out
PCL Out
PCH Out
Inst.
in
PCL Out
PCH Out
Inst.
in
PCL Out
Microcontroladores 8051
PCH Out
Inst.
in
PCL Out
23
Captulo 2:
Operao de executar um
programa passo a passo:
JNB
JB
RETI
P3.2,$
P3.2,$
Prentice Hall
Microcontroladores 8051
24
Captulo 2:
Modos de reduo de potncia em
microcontroladores CHMOS:
Modo Idle
Modo Baixa Potncia
Registrador PCON:
bit 7
SMOD
bit 6
-
bit 5
-
bit 4
-
bit 3
GF1
bit 2
GF0
bit 1
PD
bit 0
IDL
-SMOD: Bit de duplo baud rate (freqncia de recepo e transmisso do canal de comunicao
serial). Quando igual a 1 lgico, o baud rate dobrado quando o canal de comunicao serial ou est
no modo 1, ou 2, ou 3;
-GF1: flag de uso de propsito geral;
-GF0: flag de uso de propsito geral;
-PD: Bit de baixa potncia (Power Down). Fazendo este bit igual a 1 lgico, ativa o modo de baixa
potncia.
-IDL: Bit de Modo Idle. Fazendo este bit igual a 1 lgico, ativa o modo Idle.
Prentice Hall
Microcontroladores 8051
25