AT89S52 8-bit Microcontroller with 8K Bytes In-System Programmable Flash

AT89S52 is one of the popular microcontrollers from the Atmel family. AT89S52 microcontroller is an 8-bit CMOS microcontroller having 8k Flash memory and 256 bytes of RAM memory. It can be operated at 33MHz maximum operating frequency by using an external oscillator. Like other microcontrollers, It has GPIO pins, three 16-bit timers, one full-duplex UART communication port, three 16-bit general-purpose timers, on-chip oscillator.

Furthermore, it has 40 pins, out of which 32 are GPIO pins. AT89S52 also has an inbuilt Watchdog timer to operate microcontroller low power mode. This microcontroller finds its applications from domestic devices to the industrial level to provide digital control to embedded systems.

AT89S52 8-bit Microcontroller

AT89S52 Microcontroller Introduction

It is an 8-bit, low power, high performance, CMOS technology based microcontroller with having an operating frequency range between 0 to 33MHz. The chip can work in two power selectable operating modes. This device offers 32 GPIO pins which can be used as digital input-output pins or also same pins can be used for alternate functions.

AT89S52 Pinout

The pinout of the AT89S52 8-bit microcontroller is shown below:

AT89S52 8-bit Microcontroller pinout diagram

Pin Configuration

AT89S52 8-bit microcontroller is available in three packages. But the pinout diagram is the same for all three packages. The pin configuration detail in tabular is mentioned below:

Pin NumberPin NameFunction
32-39Port 08 Address and Data/GPIO pins
1-8Port 18 multi-purpose GPIO pins  
21-28Port 28 GPIO pins
10-17Port 38 multi-purpose GPIO pins
9RSTMaster Reset pin
18XTAL2External Oscillator Output pin
19XTAL1External Oscillator Input pin
20GNDGround pin
40VCCPower Supply pin
31EA/VPPExternal Access Enable/Flash Enable Supply pin
30ALE/PROGAddress Latch Enable/Flash Program pin
29PSENProgram Store Enable pin

Port 0 pins

All ports of AT89S52 are 8-bit which means each port has 8 multifunctional pins. These general-purpose input/output pins can be configured for other operations as well when configured for that purpose using alternate functions of configuration registers. If they are at a low state, they work as bidirectional high-impedance input pins. But if they pulled high, they are used as digital output pins.

Port0 pins are also used to upload lower bytes of code to the internal program memory of the AT89S52 microcontroller and also used for verification of uploaded code. While using these pins for programming, we need to connect external pull-up resistors with these pins.

Port 1 pins

Similar to port 0, Port1 also has 8-bit dual-directional pins with internal pull-up resistors. Some of these GPIO pins are used for in-circuit system programming interface and some are used as alternate functions for three 16-bit Timer/Counter pins.

Pin NumberFunction
P1.0T2
P1.1T2EX
P1.5MOSI
P1.6MISO
P1.7SCK

Port 2 pins

Like port 1, Port2 also has 8-bit dual-directional pins with internal pull-up resistors. Some of these GPIO pins are used for in-circuit system programming interface and some are used as alternate functions for three 16-bit Timer/Counter pins.

Port2 pins are also used to upload higher bytes of code to the internal program memory of the AT89S52 microcontroller and also used for verification of uploaded code. While using these pins for programming, we need to connect external pull-up resistors with these pins.

Port 3 pins

Port 3 is also an 8-bit port and has 8 GPIO pins. In addition to the input/output function, these pins also have some special features. Port 3 also used for UART serial data transfer, external interrupts, and performs external data memory read/write operations.

Pin NumberFunction
P3.0RXD
P3.1TXD
P3.2INT0
P3.3INT1
P3.4T0
P3.5T1
P3.6WR
P3.7RD

All these pins are bi-directional and TTL pins. They can sink and source currents and all these have internal pull up resistors for properly defining their states.

AT89S52 Features and Specifications

Features and PeripheralsAvailability
Architecture8-bit PIC
Pin Count40
RAM256 Bytes
EEPROM/HEFNo
Program Memory8 KiloBytes
CPU speed33 MHz
Internal OscillatorNo
Number of Comparators2
ADCNo
DACNo
Number of Programmable I/O pins32
Window Watchdog TimerNo
External Oscillator Frequency23 MHz (max)
Resolution of PWMNo
Number of 16-bit Timers3
Program Memory TypeFlash
UART module1
Power-off FlagYes
Dual Data PointerYes
Operating Voltage4V – 5.5 V
Operating Temperature-550C – 1250C

Some of the eminent detailed features are listed below:

  • It is a high-performance CMOS microcontrollers with Flash Technology
  • The unit operates at a wide range of 4 – 5.5 volts, so it is a low power IC.
  • The device supports In-system Programming both page and byte mode for the Flash memory.
  • The operational frequency is up to 33MHz but can be altered for saving energy.
  • The module has a quick programming time with 10,000 read/write cycles.
  • The Random Access memory is organized in 256×8 bits.
  • The serial communication takes place through a full duplex UART module.
  • It comes with a reset option, three 16-bit timers and eight interrupts.
  • AT89S52 has two power modes, i.e., idle mode in which  stops processing unit stops while other peripheral keep working and power-down mode that halts oscillator and other functions and save RAM contents.
  • Watchdog timer to work and wake the device up from sleep mode and can be activated or deactivated through programming

How to program AT89S52 8-bit Microcontroller

Different software and compilers available in the market can be used to program Atmel microcontrollers family.

Support Compilers

We need an IDE, IPE, a suitable compiler, and a programmer/debugger to develop a program. The function of an IDE(Integrated Development Environment) is to provide the environment for programming. The compiler converts the program into readable HEX files. The IPE(Integrated Programming Environment) serves the purpose of burning HEX files in AVR MCUs.For IDE , we commonly use Keil uVision IDE.

USBASP is an In-circuit programmer/debugger which plays an integral role in programming microcontrollers. It supports In-Circuit-Serial-Programming and is operated by a computer to burn the code into AT89S52 8-bit microcontroller. For hardware programming, it is purchased separately. It is advised to simulate the program beforehand on the software for optimization and error free programs. Furthermore, hardware like 12 Volts adapter, 7805 Voltage Regulator, Crystal Oscillator and capacitors are required.

The picture below is the connection diagram for programming the AT89S52 controller:

AT89S52 8-bit Microcontroller Programming circuit

Applications

  • Sensor Systems
  • Medical systems
  • Home automation systems
  • Low-cost embedded systems
  • Automobiles
  • Defense and safety purposes

2D Diagram

2D diagram

8051 Microcontroller Tutorials:

Leave a Comment