Features Compatible with MCS 51 Products 2K/4K Bytes of In-System Programmable (ISP) Flash Program Memory Serial Interface for Program Downloading Endurance: 10,000 Write/Erase Cycles 2.7V to 5.5V Operating Range Fully Static Operation: 0 Hz to 24 MHz (x1 and x2 Modes) Two-level Program Memory Lock 256 x 8-bit Internal RAM 15 Programmable I/O Lines 8-bit Two 16-bit Timer/Counters Six Interrupt Sources Microcontroller Programmable Serial UART Channel Direct LED Drive Outputs with 2K/4K On-chip Analog Comparator with Selectable Interrupt Bytes Flash 8-bit PWM (Pulse-width Modulation) Low Power Idle and Power-down Modes Brownout Reset Enhanced UART Serial Port with Framing Error Detection and Automatic AT89S2051 Address Recognition Internal Power-on Reset AT89S4051 Interrupt Recovery from Power-down Mode Programmable and Fuseable x2 Clock Option Four-level Enhanced Interrupt Controller Power-off Flag Flexible Programming (Byte and Page Modes) Page Mode: 32 Bytes/Page User Serviceable Signature Page (32 Bytes) 1. Description The AT89S2051/S4051 is a low-voltage, high-performance CMOS 8-bit microcon- troller with 2K/4K bytes of In-System Programmable (ISP) Flash program memory. The device is manufactured using Atmels high-density nonvolatile memory technol- ogy and is compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S2051/S4051 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. Moreover, the AT89S2051/S4051 is designed to be function compatible with the AT89C2051/C4051 devices, respectively. The AT89S2051/S4051 provides the following standard features: 2K/4K bytes of Flash, 256 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a six-vector, four- level interrupt architecture, a full duplex enhanced serial port, a precision analog comparator, on-chip and clock circuitry. Hardware support for PWM with 8-bit resolu- tion and 8-bit prescaler is available by reconfiguring the two on-chip timer/counters. In addition, the AT89S2051/S4051 is designed with static logic for operation down to zero frequency and supports two software-selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The power-down mode saves the RAM contents but freezes the disabling all other chip functions until the next external interrupt or 3390EMICRO6/08 hardware reset.The on-board Flash program memory is accessible through the ISP serial interface. Holding RST active forces the device into a serial programming interface and allows the program mem- ory to be written to or read from, unless one or more lock bits have been activated. 2. Pin Configuration 2.1 20-lead PDIP/SOIC RST/VPP 1 20 VCC (RXD) P3.0 2 19 P1.7 (SCK) (TXD) P3.1 3 18 P1.6 (MISO) XTAL2 4 17 P1.5 (MOSI) XTAL1 5 16 P1.4 (INT0) P3.2 6 15 P1.3 (INT1) P3.3 7 14 P1.2 (T0) P3.4 8 13 P1.1 (AIN1) (T1) P3.5 9 12 P1.0 (AIN0) GND 10 11 P3.7 3. Block Diagram 2 AT89S2051/S4051 3390EMICRO6/08