T89C51RB2/RC2 8-bit Microcontroller with 16 Kbytes/ 32 Kbytes FLASH 1. Description T89C51RB2/RC2 is a high performance FLASH version of the 80C51 8-bit microcontrollers. It contains a 16K or 32Kbytes Flash memory block for program and data. The 16 Kbytes or 32 Kbytes 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 T89C51RB2/RC2 retains all features of the 80C52 with 256 bytes of internal RAM, a 7-source 4-level interrupt controller and three timer/counters. In addition, the T89C51RB2/RC2 has a Programmable Counter Array, an XRAM of 1024 byte, a Hardware Watchdog Timer, a Keyboard Interface, a SPI Interface, a more versatile serial channel that facilitates multiprocessor communication (EUART) and a speed improvement mechanism (X2 mode). Pinout is the standard 40/44 pins of the C52. The fully static design of the T89C51RB2/RC2 allows to reduce system power consumption by bringing the clock frequency down to any value, even DC, without loss of data. The T89C51RB2/RC2 has 2 software-selectable modes of reduced activity and 8 bit clock prescaler for further reduction in power consumption. In the Idle mode the CPU is frozen while the peripherals and the interrupt system are still operating. In the power-down mode the RAM is saved and all other functions are inoperative. The added features of the T89C51RB2/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, smart card readers. 2. Features • 80C52 Compatible • On-chip 1024 bytes expanded RAM (XRAM) • 8051 pin and instruction compatible • Four 8-bit I/O ports • Software selectable size (0, 256, 512, 768, 1024 bytes) • Three 16-bit timer/counters • 256 bytes selected at reset for TS87C51RB2/RC2 compatibility • 256 bytes scratch pad RAM • 10 Interrupt sources with 4 priority levels • Dual Data Pointer • Variable length MOVX for slow RAM/peripherals • ISP (In System Programming) using standard VCC power supply. • Boot ROM contains low level FLASH programming routines and a default serial loader • • • • • 40 MHz in standard mode • 20 MHz in X2 mode (6 clocks/machine cycle) Memory • Byte and page (128 bytes) erase and write • 100k write cycles SPI Interface (Master / Slave Mode) 8-bit clock prescaler Improved X2 mode with independant selection for CPU and each peripheral • Programmable Counter Array 5 Channels with: • High-Speed Architecture • 16K/32K bytes on-chip FLASH program / data Keyboard interrupt interface on port P1 • • • • • 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) Rev. B - 30-Mar-01 1 Preliminary T89C51RB2/RC2 • Hardware Watchdog Timer (One-time enabled with Reset-Out) • Power control modes: • Idle Mode. • Power-down mode. - 50µA at 3V - 100µA Commercial at 5V - 150µA Industrial at 5V • Power-Off Flag. • Power supply: 4.5 to 5.5V or 2.7 to 3.6V • Temperature ranges: Commercial (0 to +70°C) and industrial (-40°C to +85°C). • Packages: PDIL40, PLCC44, VQFP44 Table 1. Memory Size Flash (bytes) XRAM (bytes) TOTAL RAM (bytes) I/O T89C51RB2 16k 1024 1280 32 T89C51RC2 32k 1024 1280 32 (2) (2) XTAL1 XTAL2 (1) EUART + BRG ALE/ PROG RAM 256x8 C51 CORE PSEN Flash 32Kx8 or 16Kx8 XRAM 1Kx8 Boot ROM 2Kx8 (1) (1) PCA T2 T2EX PCA ECI Vss VCC TxD RxD 3. Block Diagram (1) Timer2 IB-bus CPU EA Parallel I/O Ports & Ext. Bus Port 0 Port 1 Port 2 Port 3 Port I2 Watch Key Dog Board SPI SS MOSI SCK MISO PI2 P3 P2 P1 (1) (1) (1) (1) P0 (2) (2) INT1 (2) (2) T1 (2) INT Ctrl INT0 Timer 0 Timer 1 RESET WR (2) T0 RD (1): Alternate function of Port 1 (2): Alternate function of Port 3 2 Rev. B - 30-Mar-01 Preliminary T89C51RB2/RC2 4. SFR Mapping The Special Function Registers (SFRs) of the T89C51RB2/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: IE0, IPL0, IPH0 , IE1 , 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 Rev. B - 30-Mar-01 3 Preliminary T89C51RB2/RC2 Table 2. Sfr mapping Table below shows all SFRs with their address and their reset value. Bit Non Bit addressable addressable 0/8 F8h 1/9 CH 0000 0000 2/A 3/B 4/C 5/D 6/E CCAP0H CCAP1H CCAPL2H CCAPL3H CCAPL4H XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX F7h CL 0000 0000 E8h CCAP0L CCAP1L CCAPL2L CCAPL3L CCAPL4L XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX EFh ACC 0000 0000 E0h D8h D0h C8h CCON 00X0 0000 PSW 0000 0000 T2CON 0000 0000 E7h CMOD 00XX X000 FCON (1) XXXX 0000 T2MOD XXXX XX00 CCAPM0 X000 0000 IPL0 X000 000 SADEN 0000 0000 P3 1111 1111 IE0 0000 0000 P2 1111 1111 IE1 XXXX X000 SADDR 0000 0000 98h SCON 0000 0000 SBUF XXXX XXXX 90h P1 1111 1111 B8h B0h A8h A0h TCON 0000 0000 P0 1111 1111 0/8 CCAPM1 X000 0000 CCAPM2 X000 0000 CCAPM3 X000 0000 CCAPM4 X000 0000 DFh D7h RCAP2L 0000 0000 C0h 80h FFh B 0000 0000 F0h 88h 7/F RCAP2H 0000 0000 TL2 0000 0000 TH2 0000 0000 CFh SPCON 0001 0100 SPSTA 0000 0000 SPDAT XXXX XXXX C7h BFh IPL1 XXXX X000 IPH1 XXXX X111 IPH0 B7h X000 0000 CKCON1 AFh XXXX XXX0 WDTRST WDTPRG A7h XXXX XXXX XXXX X000 AUXR1 XXXX X0X0 BRL 0000 0000 BDRCON XXX0 0000 KBLS 0000 0000 KBE 0000 0000 KBF 0000 0000 9Fh CKRL 1111 1111 TMOD 0000 0000 SP 0000 0111 1/9 TL0 0000 0000 DPL 0000 0000 2/A TL1 0000 0000 DPH 0000 0000 3/B TH0 0000 0000 4/C TH1 0000 0000 5/D AUXR XX0X 0000 6/E CKCON0 0000 0000 PCON 00X1 0000 7/F 97h 8Fh 87h reserved (1) FCON access is reserved for the FLASH API and ISP software. 4 Rev. B - 30-Mar-01 Preliminary T89C51RB2/RC2 5. Pin Configurations P1.0/T2 1 40 VCC P1.1/T2EX/SS 2 P0.0/AD0 P1.2/ECI P1.3CEX0 P1.4/CEX1 3 4 39 38 P1.5/CEX2/MISO P1.6/CEX3/SCK 36 35 P0.3/AD3 P0.4/AD4 7 8 34 33 P0.5/AD5 9 32 P0.7/AD7 10 31 30 EA ALE/PROG 29 28 PSEN P2.7/AD15 P2.6/AD14 P2.5/AD13 24 23 P2.2/AD10 XTAL1 19 20 22 21 P2.1/AD9 P1.7/CEx4/MOSI 9 37 RST P0.6/AD6 10 36 P3.0/RxD P0.7/AD7 11 12 35 34 33 EA P2.0/AD8 PLCC44 P0.5/AD5 NIC* P3.1/TxD 13 P3.2/INT0 14 15 32 31 PSEN 16 30 P2.6/A14 17 29 P2.5/A13 ALE/PROG P2.7/A15 P2.3/A11 P2.4/A12 P2.2/A10 P2.1/A9 NIC* P2.0/A8 VSS P3.6/WR P0.3/AD3 P0.2/AD2 P0.1/AD1 P0.0/AD0 VCC NIC* 18 19 20 21 22 23 24 25 26 27 28 P1.0/T2 P1.1/T2EX/SS 2 1 44 43 42 41 40 P0.4/AD4 P3.4/T0 P3.5/T1 P1.2/ECI 3 39 38 P3.3/INT1 P1.3/CEX0 4 P1.6/CEX3/SCK NIC* P1.4/CEX1 5 7 8 XTAL1 VSS 6 P0.2/AD2 P0.3/AD3 17 18 P1.5/CEX2/MISO P0.1/AD1 P3.7/RD XTAL2 P2.4/AD12 P2.3/AD11 P0.0/AD0 25 VCC 16 NIC* P3.6/WR P1.0/T2 27 26 P1.1/T2EX/SS 14 15 P1.2/ECI P3.5/T1 P3.4/T0 P1.3/CEX0 PDIL40 11 12 13 P0.6/AD6 XTAL2 P3.2/INT0 P3.3/INT1 6 5 P1.4/CEX1 P3.0/RxD P3.1/TxD P0.1/AD1 P0.2/AD2 P3.7/RD P1.7CEX4/MOSI RST 37 44 43 42 41 40 39 38 37 36 35 34 P1.5/CEX2/MISO 1 P1.6/CEX3/SCK P1.7/CEX4/MOSI 2 RST P3.0/RxD NIC* P3.1/TxD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 33 32 31 3 4 5 VQFP44 1.4 6 7 8 9 10 11 P0.4/AD4 P0.5/AD5 P0.6/AD6 30 29 28 27 P0.7/AD7 EA 26 25 PSEN NIC* ALE/PROG 24 P2.7/A15 P2.6/A14 23 P2.5/A13 P2.3/A11 P2.4/A12 P2.2/A10 P2.1/A9 NIC* P2.0/A8 VSS XTAL1 XTAL2 P3.7/RD P3.6/WR 12 13 14 15 16 17 18 19 20 21 22 *NIC: No Internal Connection Rev. B - 30-Mar-01 5 Preliminary T89C51RB2/RC2 Table 3. Pin Description for 40/44 pin packages Pin Number Mnemonic DIL LCC VQFP44 1.4 Type Name and Function VSS 20 22 16 I VCC 40 44 38 I P0.0-P0.7 39-32 43-36 37-30 I/O P1.0-P1.7 1-8 2-9 40-44 1-3 I/O 1 2 40 2 3 41 3 4 42 4 5 43 5 6 44 6 7 1 I/O I/O I/O I I I/O I I/O I/O I/O I/O I/O I/O I/O 7 8 2 I/O I/O I/O 8 9 3 I/O I/O I/O XTAL1 19 21 15 I XTAL2 18 20 14 O Ground: 0V reference Power Supply: This is the power supply voltage for normal, idle and power-down operation Port 0: Port 0 is an open-drain, bidirectional I/O port. Port 0 pins that have 1s written to them float and can be used as high impedance inputs. Port 0 must be polarized to VCC or VSS in order to prevent any parasitic current consumption. Port 0 is also the multiplexed low-order address and data bus during access to external program and data memory. In this application, it uses strong internal pull-up when emitting 1s. Port 0 also inputs the code bytes during FLASH programming. External pull-ups are required during program verification during which P0 outputs the code bytes. Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Port 1 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally pulled low will source current because of the internal pullups. Port 1 also receives the low-order address byte during memory programming and verification. Alternate functions for T89C51RB2/RC2 Port 1 include: P1.0 : Input / Output T2 (P1.0): Timer/Counter 2 external count input/Clockout P1.1 : Input / Output T2EX : Timer/Counter 2 Reload/Capture/Direction Control SS : SPI Slave Select P1.2 : Input / Output ECI : External Clock for the PCA P1.3: Input / Output CEX0 : Capture/Compare External I/O for PCA module 0 P1.4 : Input / Output CEX1 : Capture/Compare External I/O for PCA module 1 P1.5 : Input / Output CEX2 : Capture/Compare External I/O for PCA module 2 MISO : SPI Master Input Slave Output line When SPI is is in master mode , MISO receives data from the slave peripheral. When SPI is in slave mode , MISO outputs data to the master controller. P1.6 : Input / Output CEX3 : Capture/Compare External I/O for PCA module 3 SCK : SPI Serial Clock SCK outputs clock to the slave peripheral P1.7 : Input / Output: CEX4 : Capture/Compare External I/O for PCA module 4 MOSI : SPI Master Output Slave Input line When SPI is is in master mode , MOSI outputs data to the slave peripheral. When SPI is in slave mode , MOSI receives data from the master controller. Crystal 1: Input to the inverting oscillator amplifier and input to the internal clock generator circuits. Crystal 2: Output from the inverting oscillator amplifier 6 Rev. B - 30-Mar-01 Preliminary T89C51RB2/RC2 Pin Number Mnemonic DIL LCC VQFP44 1.4 Type Name and Function P2.0-P2.7 21-28 24-31 18-25 I/O P3.0-P3.7 10-17 11, 13-19 5, 7-13 I/O 10 11 12 13 14 15 16 17 11 13 14 15 16 17 18 19 5 7 8 9 10 11 12 13 I O I I I I O O RST 9 10 4 I/O ALE/PROG 30 33 27 O (I) PSEN 29 32 26 O EA 31 35 29 I Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. Port 2 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally pulled low will source current because of the internal pullups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @DPTR).In this application, it uses strong internal pull-ups emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @Ri), port 2 emits the contents of the P2 SFR. Some Port 2 pins receive the high order address bits during EPROM programming and verification: P2.0 to P2.5 for 16Kb devices P2.0 to P2.6 for 32Kb devices Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. Port 3 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally pulled low will source current because of the internal pullups. Port 3 also serves the special features of the 80C51 family, as listed below. RXD (P3.0): Serial input port TXD (P3.1): Serial output port INT0 (P3.2): External interrupt 0 INT1 (P3.3): External interrupt 1 T0 (P3.4): Timer 0 external input T1 (P3.5): Timer 1 external input WR (P3.6): External data memory write strobe RD (P3.7): External data memory read strobe Reset: A high on this pin for two machine cycles while the oscillator is running, resets the device. An internal diffused resistor to VSS permits a power-on reset using only an external capacitor to V CC. This pin is an output when the hardware watchdog forces a system reset. Address Latch Enable/Program Pulse: Output pulse for latching the low byte of the address during an access to external memory. In normal operation, ALE is emitted at a constant rate of 1/6 (1/3 in X2 mode) the oscillator frequency, and can be used for external timing or clocking. Note that one ALE pulse is skipped during each access to external data memory. This pin is also the program pulse input (PROG) during Flash programming. ALE can be disabled by setting SFR’s AUXR.0 bit. With this bit set, ALE will be inactive during internal fetches. Program Strobe ENable: The read strobe to external program memory. When executing code from the external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. PSEN is not activated during fetches from internal program memory. External Access Enable: EA must be externally held low to enable the device to fetch code from external program memory locations 0000H to FFFFH (RD). If security level 1 is programmed, EA will be internally latched on Reset. Rev. B - 30-Mar-01 7 Preliminary T89C51RB2/RC2 6. Ordering Information T 89C51Rx2 -3C Packages: 3C: PDIL40 SL: PLCC44 RL: VQFP44 (1.4mm) M C S Temperature Range C:Commercial 0 to 70oC I:Industrial -40 to 85oC 89C51RC2 ( 32k Flash ) 89C51RB2 ( 16k Flash ) -M: -L: Conditioning S: Stick T: Tray B: Blue Tape W: Wafer Rev. B - 30-Mar-01 VCC: 5V 40 MHz, X1 mode 20 MHz, X2 mode VCC: 3 V 40 MHz, X1 mode 20 MHz, X2 mode 8 Preliminary T89C51RB2/RC2 Table 4. Possible order entries Extension Type T89C51RB2 T89C51RC2 -3CSCM Stick, PDIL40, Com, 5V X X -3CSIM X X -SLSCM Stick, PLCC44, Com, 5V X X -SLSIM Stick, PLCC44, Ind, 5V X X -SLSCL Stick, PLCC44, Com, 3V X X -SLSIL Stick, PLCC44, Ind, 3V X X -RLTIM Tray, VQFP44, Ind, 5V X X -RLTCL Tray, VQFP44, Com, 3V X X -SLSEM Stick, PLCC44, Sample, 5V X X Stick, PDIL40, Ind, 5V 9 Rev. B - 30-Mar-01 Preliminary