Professional Documents
Culture Documents
AT89S52 8-Bit Microcontroller With 8K Bytes In-System Programmable Flash
AT89S52 8-Bit Microcontroller With 8K Bytes In-System Programmable Flash
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.
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.
P1.0 T2
P1.1 T2EX
P1.5 MOSI
P1.6 MISO
P1.7 SCK
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 Number Function
P3.0 RXD
P3.1 TXD
P3.2 INT0
P3.3 INT1
P3.4 T0
P3.5 T1
P3.6 WR
P3.7 RD
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.
Pin Count 40
EEPROM/HEF No
Internal Oscillator No
Number of Comparators 2
ADC No
DAC No
Resolution of PWM No
UART module 1
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.