memory

AT89C51


sync_alt

Serial Communications Interfaces

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read-only memory (PEROM).

The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pinout.

AT89C51 and AT89S51

The AT89C51 and AT89S51 are both 8-bit microcontrollers from Atmel, part of the 8051 family. However, they have several key differences:

  1. Flash Memory

    The AT89C51 has 4KB of flash memory, while the AT89S51 has 8KB. This means the AT89S51 can store larger programs.

  2. ISP (In-System Programming)

    The AT89S51 supports In-System Programming (ISP) through an SPI interface. This means you can update the firmware of the microcontroller while it is in the system, which is useful for updates after the product has been deployed. On the other hand, AT89C51 does not have ISP capability.

  3. Programming Voltage

    The AT89C51 requires a higher voltage (12V) for programming, while the AT89S51 can be programmed at the standard 5V. This makes the AT89S51 easier to use in many development and production environments.

  4. Programming Interface

    The AT89C51 is programmed using a parallel programming interface, while the AT89S51 is programmed using a serial programming interface (SPI). Serial programming can be slower but requires fewer connections and can be done in-circuit, as mentioned above.

AT89C51 Pinouts

The on-chip Flash allows the program memory to be reprogrammed in-system or by a conven­tional nonvolatile memory programmer.

By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer that provides a highly flexible and cost-effective solution to many embedded control applications.

One of the key advantages of the AT89C51 is its ease of programming. Developers can use a variety of programming languages and tools, including assembly language and C compilers, to write code for the microcontroller. This flexibility allows for efficient development and rapid prototyping.

The AT89C51 supports a wide range of input voltage levels, making it suitable for various power supply configurations. Additionally, it offers low power consumption, making it suitable for battery-operated devices and energy-efficient applications.

AT89C51 Features And Block Diagram

The AT89C51 provides the following standard features:

  • 4K bytes of Flash
  • 128 bytes of RAM
  • 32 I/O lines
  • Two 16-bit timer/counters
  • A five vector two-level interrupt architecture
  • A Full duplex serial port, on-chip oscillator, and clock circuitry.
AT89C51 Block Diagram

In addition, the AT89C51 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 oscillator disabling all other chip functions until the next hardware reset.

AT89C51 Pin Description

AT89C51 Pin Description
AT89C51 Microcontroller

VCC

Supply voltage.

GND

Ground.

Port 0

Port 0 is another 8-bit input/output (I/O) port with some unique characteristics. It can be used to connect different devices and sensors to the microcontroller.

When we use Port 0 as an output port, each pin can control the flow of information for up to eight devices. If we write a '1' to any of the Port 0 pins, those pins become high-impedance inputs, meaning they can receive information without affecting other devices connected to them.

Port 0 is important for accessing external programs and data memory. It can be configured to act as a multiplexed low-order address/data bus, which means it helps with sending and receiving information to and from external memory. In this mode, Port 0 has internal pullups to help with stable data transmission.

During Flash programming, Port 0 receives the code bytes, and during program verification, it outputs the code bytes. For program verification, we need to connect external pullups to ensure reliable data transmission.

Port 1

Port 1 is an 8-bit input/output (I/O) port that can be used to connect devices to the microcontroller. It has some special features and uses internal pullups, which are like little helpers that make things easier.

When we write a '1' to any of the Port 1 pins, the internal pullups pull the pin to a high voltage level, and we can use those pins as inputs to get information from external devices. If an external device connected to a Port 1 pin pulls it low, the pin can provide a small amount of current because of the internal pullups.

Port 1 is also involved in programming and verifying the flash memory. It receives the low-order part of the address bytes during these operations.

Port 2

Port 2 is an 8-bit input/output (I/O) port that can be used to connect various devices and sensors to the microcontroller. It has some special features and uses internal pullups, which are like little helpers that make things easier.

When we write a '1' to any of the Port 2 pins, the internal pullups pull the pin to a high voltage level, and we can use those pins as inputs to get information from external devices. If an external device connected to a Port 2 pin pulls it low, the pin can provide a small amount of current because of the internal pullups.

Port 2 is important for reading data from external memory. It helps with fetching instructions and accessing data stored outside the microcontroller.

When we need to get data from a specific memory address, Port 2 sends the high-order part of that address.

It also helps with certain control signals during programming and checking the flash memory.

Port 3

Port 3 is an 8-bit input/output (I/O) port that can be used to connect devices to the AT89C51 microcontroller. It has some convenient features, including internal pullups.

When we write a '1' to any of the Port 3 pins, the internal pullups pull the pin to a high voltage level. This allows us to use those pins as inputs to receive information from external devices.

If an external device connected to a Port 3 pin pulls it low, the pin can provide a small amount of current because of the pull-ups.

Port 3 serves additional functions in the AT89C51 microcontroller. It receives control signals during Flash programming and verification. These signals are important for programming and verifying flash memory.

Port Pin Alternate Functions
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)

Alternate Functionality

Port 3 pins can serve as alternate function pins for certain special features and peripherals of the microcontroller. These functions can include serial communication interfaces (such as UART), interrupt inputs, and external memory control signals.

External Memory Interface

Port 3 can be used as an address/data bus when accessing external programs or data memory. It provides the necessary signals for addressing memory locations and transferring data between the microcontroller and external memory devices.

Interrupt Inputs

Some of the Port 3 pins can be configured as external interrupt inputs. These pins can detect specific events or signals from external devices and generate interrupts to the microcontroller. Interrupts are used to handle time-critical tasks or respond to external events in a timely manner.

Timer/Counter Inputs

Port 3 pins can also be used as inputs for capturing external events or generating input signals for timers and counters. This feature enables precise timing and counting operations by synchronizing with external events.

External Reset Input

One of the Port 3 pins, commonly referred to as RST, serves as an external reset input. Applying a reset signal to this pin forces the microcontroller to restart execution from the beginning of the program.

Control Signals

Port 3 may receive various control signals during specific operations, such as Flash programming and verification. These signals help coordinate and regulate the programming or verification process, ensuring reliable and accurate data transfer.

RST

Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

ALE/PROG

Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes.

Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high.

PSEN

Program Store Enable is the read strobe to external program memory. When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH.

Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier.

AT89C51 Memory Organization

The AT89C51 microcontroller has a total of 4KB of on-chip program memory. This program memory is organized into 8KB address space, from address 0000H to 1FFFH.

AT89C51 Memory Organization

The program memory is further divided into two parts:

Code Memory

The code memory of the AT89C51 contains the user's program code. It occupies the address range from 0000H to 0FFFH (4KB) and is non-volatile, meaning it retains the program even when the power is turned off.

Data Memory

The data memory of the AT89C51 is divided into two parts:

Internal RAM

The internal RAM provides 128 bytes of data storage. It is organized as four 8-bit registers (R0 to R7) and three 16-bit register banks (R0-R1, R2-R3, and R4-R7) that can be accessed using different addressing modes.

Special Function Registers (SFR)

The AT89C51 has a set of special function registers, which are memory-mapped registers used for controlling various on-chip peripherals and functions. These registers are accessed using direct addressing.

Apart from the program memory and data memory, the AT89C51 also supports external memory interfacing through the address bus (16 bits) and data bus (8 bits).

AT89C51 Memory Map

Memory Address Range Description
Code Memory 0000H - 0FFFH User's program code, non-volatile
Internal RAM 00H - 7FH 128 bytes of data storage
Special Function Registers (SFR) 80H - FFH Memory-mapped registers for controlling on-chip peripherals
Loading...

signpost

GPIO

The AT89C51 microcontroller features General-Purpose Input/Output (GPIO) ports that provide versatile input and output capabilities for interfacing with external devices. These GPIO ports, often referred to as Port 0, Port 1, Port 2, and Port 3, offer flexible configuration options and control methods, making them essential for various applications.

The GPIO ports of the AT89C51 allow bidirectional communication, enabling the microcontroller to receive inputs from external devices and provide outputs as needed. These ports are programmable, meaning their functionalities can be easily configured through software instructions to suit specific application requirements.

timer

Timers

Timers are a fundamental part of any microcontroller. They play an integral role in time-sensitive applications, helping to track, schedule, and synchronize events, perform precise delays, and even generate specific frequencies for communication protocols.

AT89C51, an advanced 8051 architecture-based microcontroller, is equipped with robust and versatile timers/counters that can be used in a plethora of applications.

sync_alt

Serial Communications Interfaces

The AT89C51 is a classic microcontroller from the Atmel 8051 family, renowned for its embedded serial communication capabilities. This MCU provides UART (Universal Asynchronous Receiver-Transmitter) as its primary means of serial communication, enabling asynchronous data transfer between devices.

With a built-in full-duplex mode, it allows for simultaneous transmission and reception of data. The AT89C51's UART interface is designed for a broad range of applications, from basic data logging to advanced communication systems. In the realm of microcontrollers, the AT89C51 is celebrated for its straightforward yet effective serial communication solutions, making it a favorite among developers and hobbyists alike.

Search