Features
•
80C52 Compatible
– 8051 Pin and Instruction Compatible
– Four 8-bit I/O Ports
– Three 16-bit Timer/Counters
– 256 Bytes Scratch Pad RAM
– 9 Interrupt Sources with 4 Priority Levels
– Dual Data Pointer
Variable Length MOVX for Slow RAM/Peripherals
ISP (In-system Programming) Using Standard V
CC
Power Supply
Boot ROM Contains Low Level Flash Programming Routines and a Default Serial
Loader
High-speed Architecture
– 48 MHz in Standard Mode and Internal Code Execution (40 MHz for external code)
– 24 MHz in X2 Mode and internal code execution (20 MHz for external code)
– 16K/32K Bytes On-chip Flash Program/Data Memory
– Byte and Page (128 Bytes) Erase and Write
– 100K Write Cycles
On-chip 1024 Bytes Expanded RAM (XRAM)
– Software Selectable Size (0, 256, 512, 768, 1024 Bytes)
– 256 Bytes Selected at Reset for TS87C51RB2/RC2 Compatibility
Keyboard Interrupt Interface on Port P1
SPI Interface (Master/Slave Mode)
8-bit Clock Prescaler
Improved X2 Mode with Independent Selection for CPU and Each Peripheral
Programmable Counter Array 5 Channels
– High-speed Output
– Compare/Capture
– Pulse Width Modulator
– Watchdog Timer Capabilities
Asynchronous Port Reset
Full Duplex Enhanced UART
Dedicated Baud Rate Generator for UART
Low EMI (Inhibit ALE)
Hardware Watchdog Timer (One-time Enabled with Reset-out)
Power Control Modes
– Idle Mode
– Power-down Mode
– Power-off Flag
Power Supply:
– 2.7 to 3.6 (3V Version)
– 2.7 to 5.5V (5V Version)
Temperature Ranges: Commercial (0 to +70°C) and Industrial (-40°C to +85°C)
Packages: PDIL40, PLCC44, VQFP44
•
•
•
•
8-bit
Microcontroller
with 16K/
32K Bytes Flash
AT89C51RB2
AT89C51RC2
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Description
The AT89C51RB2/RC2 is a high-performance Flash version of the 80C51 8-bit micro-
controllers. It contains a 16K or 32K Bytes Flash memory block for program and data.
The Flash memory can be programmed either in parallel mode or in serial mode with
the ISP capability or with software. The programming voltage is internally generated
from the standard VCC pin.
The AT89C51RB2/RC2 retains all features of the 80C52 with 256 Bytes of internal
RAM, a 9-source 4-level interrupt controller and three timer/counters.
Rev. 4180B–8051–04/03
In addition, the AT89C51RB2/RC2 has a Programmable Counter Array, an XRAM of
1024 Bytes, a Hardware Watchdog Timer, a Keyboard Interface, an SPI Interface, a
more versatile serial channel that facilitates multiprocessor communication (EUART)
and a speed improvement mechanism (X2 mode).
The Pinout is the standard 40/44 pins of the C52.
The fully static design reduces system power consumption of the AT89C51RB2/RC2 by
allowing it to bring the clock frequency down to any value, even DC, without loss of data.
The AT89C51RB2/RC2 has 2 software-selectable modes of reduced activity and 8-bit
clock prescaler for further reduction in power consumption. In Idle mode, the CPU is fro-
zen while the peripherals and the interrupt system are still operating. In power-down
mode, the RAM is saved and all other functions are inoperative.
The added features of the AT89C51RB2/RC2 make it more powerful for applications
that need pulse width modulation, high speed I/O and counting capabilities such as
alarms, motor control, corded phones, and smart card readers.
Table 1.
Memory Size
Part Number
AT89C51RB2
AT89C51RC2
Flash (Bytes)
16K
32K
XRAM (Bytes)
1024
1024
TOTAL RAM
(Bytes)
1280
1280
I/O
32
32
Block Diagram
Figure 1.
Block Diagram
T2EX
PCA
RxD
TxD
Vss
V
CC
ECI
T2
(1)
SPI
(1) (1) (1) (1)
MISO
P1
P2
P3
MOSI
SCK
P0
(2) (2)
XTAL1
XTAL2
(1)
Boot
ROM
2Kx8
(1) (1)
EUART
+
BRG
RAM
256x8
Flash
32Kx8 or
16Kx8
XRAM
1Kx8
PCA
Timer2
ALE/ PROG
PSEN
CPU
EA
RD
WR
(2)
(2)
C51
CORE
IB-bus
Timer 0
Timer 1
INT
Ctrl
Parallel I/O Ports & Ext. Bus
Port 0 Port 1 Port 2 Port 3
Watch Key
Dog Board
(2) (2)
RESET
T0
T1
(2) (2)
INT0
INT1
Notes:
1. Alternate function of Port 1.
2. Alternate function of Port 3.
2
AT89C51RB2/RC2
4180B–8051–04/03
SS
AT89C51RB2/RC2
SFR Mapping
The Special Function Registers (SFRs) of the AT89C51RB2/RC2 fall into the following
categories:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
C51 core registers: ACC, B, DPH, DPL, PSW, SP
I/O port registers: P0, P1, P2, P3
Timer registers: T2CON, T2MOD, TCON, TH0, TH1, TH2, TMOD, TL0, TL1, TL2,
RCAP2L, RCAP2H
Serial I/O port registers: SADDR, SADEN, SBUF, SCON
PCA (Programmable Counter Array) registers: CCON, CCAPMx, CL, CH, CCAPxH,
CCAPxL (x: 0 to 4)
Power and clock control registers: PCON
Hardware Watchdog Timer registers: WDTRST, WDTPRG
Interrupt system registers: IEN0, IPL0, IPH0, IEN1, IPL1, IPH1
Keyboard Interface registers: KBE, KBF, KBLS
SPI registers: SPCON, SPSTR, SPDAT
BRG (Baud Rate Generator) registers: BRL, BDRCON
Flash register: FCON
Clock Prescaler register: CKRL
Others: AUXR, AUXR1, CKCON0, CKCON1
3
4180B–8051–04/03
Table 2.
C51 Core SFRs
Mnemonic
ACC
B
PSW
SP
DPL
DPH
Add
E0h
F0h
D0h
81h
82h
83h
Name
Accumulator
B Register
Program Status Word
Stack Pointer
Data Pointer Low Byte
Data Pointer High Byte
CY
AC
F0
RS1
RS0
OV
F1
P
7
6
5
4
3
2
1
0
Table 3.
System Management SFRs
Mnemonic
PCON
AUXR
AUXR1
CKRL
Add
87h
8Eh
A2h
85h
Name
Power Control
Auxiliary Register 0
Auxiliary Register 1
Clock Reload Register
7
SMOD1
DPU
-
CKRL7
6
SMOD0
-
-
CKRL6
5
-
M0
ENBOOT
CKRL5
4
-
XRS2
-
CKRL4
3
GF1
XRS1
GF3
CKRL3
2
GF0
XRS0
0
CKRL2
1
PD
EXTRAM
-
CKRL1
0
IDL
AO
DPS
CKRL0
Table 4.
Interrupt SFRs
Mnemonic
IEN0
IEN1
IPH0
IPL0
IPH1
IPL1
Add
A8h
B1h
B7h
B8h
B3h
B2h
Name
Interrupt Enable Control 0
Interrupt Enable Control 1
Interrupt Priority Control High 0
Interrupt Priority Control Low 0
Interrupt Priority Control High 1
Interrupt Priority Control Low 1
7
EA
-
-
-
-
-
6
EC
-
PPCH
PPCL
-
-
5
ET2
-
PT2H
PT2L
-
-
4
ES
-
PHS
PLS
-
-
3
ET1
-
PT1H
PT1L
-
-
2
EX1
ESPI
PX1H
PX1L
SPIH
SPIL
1
ET0
EI2C
PT0H
PT0L
IE2CH
IE2CL
0
EX0
KBD
PX0H
PX0L
KBDH
KBDL
Table 5.
Port SFRs
Mnemonic
P0
P1
P2
P3
Add
80h
90h
A0h
B0h
Name
8-bit Port 0
8-bit Port 1
8-bit Port 2
8-bit Port 3
7
6
5
4
3
2
1
0
4
AT89C51RB2/RC2
4180B–8051–04/03
AT89C51RB2/RC2
Table 6.
Timer SFRs
Mnemonic
TCON
TMOD
TL0
TH0
TL1
TH1
WDTRST
WDTPRG
T2CON
T2MOD
RCAP2H
Add
88h
89h
8Ah
8Ch
8Bh
8Dh
A6h
A7h
C8h
C9h
CBh
Name
Timer/Counter 0 and 1 Control
Timer/Counter 0 and 1 Modes
Timer/Counter 0 Low Byte
Timer/Counter 0 High Byte
Timer/Counter 1 Low Byte
Timer/Counter 1 High Byte
Watchdog Timer Reset
Watchdog Timer Program
Timer/Counter 2 control
Timer/Counter 2 Mode
Timer/Counter 2 Reload/Capture
High Byte
Timer/Counter 2 Reload/Capture
Low Byte
7
TF1
GATE1
6
TR1
C/T1#
5
TF0
M11
4
TR0
M01
3
IE1
GATE0
2
IT1
C/T0#
1
IE0
M10
0
IT0
M00
-
TF2
-
-
EXF2
-
-
RCLK
-
-
TCLK
-
-
EXEN2
-
WTO2
TR2
-
WTO1
C/T2#
T2OE
WTO0
CP/RL2#
DCEN
RCAP2L
TH2
TL2
CAh
CDh
CCh
Timer/Counter 2 High Byte
Timer/Counter 2 Low Byte
Table 7.
PCA SFRs
Mnemo-
nic
Add Name
D8h
D9h
E9h
F9h
PCA Timer/Counter Control
PCA Timer/Counter Mode
PCA Timer/Counter Low Byte
PCA Timer/Counter High Byte
7
CF
CIDL
6
CR
WDTE
5
-
-
4
CCF4
-
3
CCF3
-
2
CCF2
CPS1
1
CCF1
CPS0
0
CCF0
ECF
CCON
CMOD
CL
CH
CCAPM0 DAh PCA Timer/Counter Mode 0
CCAPM1 DBh PCA Timer/Counter Mode 1
CCAPM2 DCh PCA Timer/Counter Mode 2
CCAPM3 DDh PCA Timer/Counter Mode 3
CCAPM4 DEh PCA Timer/Counter Mode 4
CCAP0H FAh
CCAP1H FBh
ECOM0
ECOM1
-
ECOM2
ECOM3
ECOM4
CAPP0
CAPP1
CAPP2
CAPP3
CAPP4
CAPN0
CAPN1
CAPN2
CAPN3
CAPN4
MAT0
MAT1
MAT2
MAT3
MAT4
TOG0
TOG1
TOG2
TOG3
TOG4
PWM0
PWM1
PWM2
PWM3
PWM4
ECCF0
ECCF1
ECCF2
ECCF3
ECCF4
PCA Compare Capture Module 0 H
CCAP0H7 CCAP0H6 CCAP0H5 CCAP0H4 CCAP0H3 CCAP0H2 CCAP0H1 CCAP0H0
PCA Compare Capture Module 1 H
CCAP1H7 CCAP1H6 CCAP1H5 CCAP1H4 CCAP1H3 CCAP1H2 CCAP1H1 CCAP1H0
CCAP2H FCh PCA Compare Capture Module 2 H
CCAP2H7 CCAP2H6 CCAP2H5 CCAP2H4 CCAP2H3 CCAP2H2 CCAP2H1 CCAP2H0
CCAP3H FDh PCA Compare Capture Module 3 H
CCAP3H7 CCAP3H6 CCAP3H5 CCAP3H4 CCAP3H3 CCAP3H2 CCAP3H1 CCAP3H0
CCAP4H FEh
CCAP0L
CCAP1L
CCAP2L
CCAP3L
CCAP4L
PCA Compare Capture Module 4 H
CCAP4H7 CCAP4H6 CCAP4H5 CCAP4H4 CCAP4H3 CCAP4H2 CCAP4H1 CCAP4H0
EAh PCA Compare Capture Module 0 L
CCAP0L7
EBh PCA Compare Capture Module 1 L
CCAP1L7
ECh PCA Compare Capture Module 2 L
CCAP2L7
EDh PCA Compare Capture Module 3 L
CCAP3L7
EEh PCA Compare Capture Module 4 L
CCAP4L7
CCAP0L6
CCAP1L6
CCAP2L6
CCAP3L6
CCAP4L6
CCAP0L5 CCAP0L4
CCAP1L5 CCAP1L4
CCAP2L5 CCAP2L4
CCAP3L5 CCAP3L4
CCAP4L5 CCAP4L4
CCAP0L3 CCAP0L2
CCAP1L3 CCAP1L2
CCAP2L3 CCAP2L2
CCAP3L3 CCAP3L2
CCAP4L3 CCAP4L2
CCAP0L1
CCAP1L1
CCAP2L1
CCAP3L1
CCAP4L1
CCAP0L0
CCAP1L0
CCAP2L0
CCAP3L0
CCAP4L0
5
4180B–8051–04/03