Sie sind auf Seite 1von 20

Arquitetura 8051

Microcontroladores

www.inacap.cl

Indice
Caractersticas del Microcontrolador 8051 Arquitetura 8051 Memria interna rea de RAM Clock y Reset Temporizacin

www.inacap.cl

Caractersticas del 8051


8051 Introducido en el mercado por Intel al incio de dcada de 80 (1981) Atualmente producido por vrias compaias en muchas variantes Microcontrolador de 8 bits

www.inacap.cl

Microcontroladores y Fabricantes
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

www.inacap.cl

8051
Part Number Fabricante ROM RAM Pinos I/O Timers Interrupciones Vcc Package

8051 8031 8751 8052 AT89C51

Intel Intel Intel Intel Atmel

4K 4K 8K 4K

128 128 128 256 128

32 32 32 32 32

2 2 2 3 2

5 5 5 8 6

5v 5v 5v 5v 5v

40 40 40 40 40

AT89C1051
AT89C2051 DS5000-8 DS5000T-8

Atmel
Atmel Dallas Dallas

1K
2K 8K 32K

64
128 128 128

15
15 32 32

1
2 2 2

3
6 6 6

3v
3v 3v 3v

20
20 40 40

www.inacap.cl

Arquitetura 8051 Standard


CPU CISC de 8 bits (8 bit Data bus, 16 bit Address bus) ULA 8 bits Registradores 8 bits 4Kbytes de ROM de programa ROM => 8051 EPROM => 8751 ROMLESS => 8031 FLASH => AT89C51 (Atmel) 256 bytes de SRAM 128 bytes de SFRs 128 bytes de usurio+pilha 64 kbytes de ROM externa 64 kbytes de RAM externa

www.inacap.cl

Perifricos
2 4 1 5

Arquitetura 8051 Standard

Timers de 16 bits com 4 modos funcionamiento puertos paralelos Canal de comunicacin serial fuentes de interrupcin independentes
2 externas 2 timers 1 canal serial

Set de instrucciones
112 instrucciones bsicas
Instruciones aritmticas; Instrucciones lgicas Instrucciones moviminto Instrucciones saltos y desvios Instrucciones de controe interno
7

www.inacap.cl

Pines 8051
P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8)
8

8051 8031 8751 AT89C51

www.inacap.cl

Vcc
GND

Pines 8051

XTAL1 XTAL2 RST

P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7

AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 A8 A9 A10 A11 A12 A13 A14 A15

PORT 0

P2.0 P2.0 P2.0 PSEN P2.0 EA/VPP P2.0 ALE/PRG P2.0 P2.0 P2.0 RXD TXD INT0 INT1 T0 T1 WR RD P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 P1.0 P1.0 P1.0 P1.0 P1.0 P1.0 P1.0 P1.0

PORT 2

PORT 1

PORT 3

www.inacap.cl

Arquitectura Microcontrolador 8051


External interrupts Interrupt Control On-chip ROM for program code
Timer/Counter

On-chip RAM

Timer 1 Timer 0

Counter Inputs

CPU
Serial Port

OSC

Bus Control

4 I/O Ports

P0 P1 P2 P3

TxD RxD
10

www.inacap.cl

CY, AC, OV
CY AC F0 RS1 RS0 OV P

B IP IE SBUF

ROTATE CONTROL INTERRUPT CONTROL SERIAL PORT

P PARITY

ULA

ACC

SFRs DECODER

SCON TH1 TL1 TH0 TL0 TMOD TCON DPH DPL SP BYTE ENDEREVEL

PROGRAM MEMORY ADDRESS DECODER

4K x 8 EPROM (8751) ROM MASK (8051) ROMLESS (8031) FLASH (AT89C51)

TIMER CONTROL

PROGRAM CONTROL PCH PCL

RAM DECODER

BIT e BYTE ENDEREVEL CONTROL BANCO REGISTRADORES DRIVERS

CONTROL PLA CONTROL ENGINE INSTRUCTION DECODER DRIVERS

OSC & TIMING CIRCUITRY XTAL1 XTAL2 EA ALE PSEN

P1 P1.0 P1.7

P3 P3.0 P3.7

P2 P2.0 P2.7

P0 P0.0 P0.7 RST VCC GND

11

www.inacap.cl

Demux Barramentos 8051


Ahigh
ALE
A13-A15 Y0 Y1

LS02

LS138
LE

ALE

E A0-15
A0-A13

AD7-0 8051

373 Alow
Di Qi Data PSEN

27C128
Q0-Q7

PSEN

12

www.inacap.cl

Memria en 8051
Memria de programa
7 FFFF PSEN 1000 0FFF 60 K External OU 0000 EA = 0 0 FFFF 7 0

64 K External

PSEN

4K 0000 Internal EA = 1

Memria de Dados
FF 80 7F 00 FFFF SFRs E RAM 64 K External 0000 RD WR

Internal
Direct Direct , Register, Reg. Indirect

13

www.inacap.cl

User & Stack


7F

RAM Interna 8051


SFRs
A8 A0 * IE * P2 SBUF * SCON * P1 TH1 TH0 TL1 TL0 TMOD * TCON PCON DPH DPL SP * P0 Interrupt Enable Ctr 1 Port 2 Serial Data Buffer Serial Control Port 1 timer 1 High timer 0 High timer 1 Low timer 0 Low timer/counter Mode timer/counter control Power Control Data pointer DPTR Stack pointer Port 0 E0 D0 B8 B0 FF F0

SFRs
*B * ACC * PSW * IP * P3

Scratch Pad Area

RAM

99 98 90

30

Bit Addressable RAM


20 18 10 08 00

Bit #00 20.0 R7 R0 R7 R0 R7 R0 R7 R0

7F OR 2F.7 Select Bank with PSW.4 , .3 = RS1, RS0

Bank 3 Bank 2 Bank 1

8D 8C 8B 8A 89 88 87 83 82 81 80

* = Bit enderevel

Bank 0

14

www.inacap.cl

Bancos de Registradores
1F

Cuatro bancos de registros Cada banco con registros R0-R7

Bank 3
18 17

8051

Bank 2
10 0F

8052

Bank 1
08 07 06 05 04 03 02 01 00 R7 R6 R5 R4 R3 R2 R1 R0

Bank 0
15

www.inacap.cl

rea de Bit e Byte


2F 2E 2D 7F 78

20h 2Fh (16 locations X 8-bits = 128 bits)

2C
2B 2A 29 28 27 26 25 24 23 22 21 20 0F 07 06 05 04 03 02 01 1A 10 08 00

Bit addressing: mov C, 1Ah or mov C, 23h.2


8051

8052

16

www.inacap.cl

Reset y Clock en 8051


Vcc 31 10 uF
30 pF

EA/VPP X1

X2 RST 9 8.2 K

17

www.inacap.cl

Reset y Clock en el 8051


Estado aps Reset: Register PC ACC B PSW SP DPTR RAM Valor 0000 0000 0000 0000 0007 0000 ????

18

www.inacap.cl

Ciclo de Mquina en el 8051


Ciclo de Mquina = 1/ (fext / 12)
Ejemplo.: Encontrar el ciclo de mquina para: (a) XTAL = 11.0592 MHz (b) XTAL = 16 MHz. Solucin: (a) 11.0592 MHz / 12 = 921.6 kHz; Ciclo de mquina = 1 / 921.6 kHz = 1.085 s (b) 16 MHz / 12 = 1.333 MHz; Ciclo de mquina = 1 / 1.333 MHz = 0.75 s
19

www.inacap.cl

Seal de reloj: 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 Seal de ALE:

Temporizacin del 8051


L Opcode L o prx. Opcode (descarta) L o prx. Opcode novamente

1- Un ciclo de instruccin de un byte. Ex: INC A. S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6

2- Un ciclo de instrucin de dos bytes. Ex: ADD A,#data.


L Opcode L segundo Byte L prox. Opcode

S1

S2

S3

S4

S5

S6

S1

S2

S3

S4

S5

S6

3- Dois ciclos de instruo de um byte. Ex: INC DPTR.


L Opcode L prox. Opcode (descata) L prox. Opcode (descarta) L prox. Opcode (descarta)

S1

S2

S3

S4

S5

S6

S1

S2

S3

S4

S5

S6

Abajo las seales y tiempos involucrados en la busqueda en la memria de programa externa de la instruccin 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 Seal de ALE: PSEN\ : RD\: P2: PCH Out P0:
Inst. in

PCH Out
PCL Out
Inst. in

PCH Out
PCL Out
Inst. in

PCH Out
PCL Out
Inst. in

PCH Out
PCL Out

20

www.inacap.cl

Das könnte Ihnen auch gefallen