How to Build a Simple Serial Programmer Circuit for AT89C2051 and AT89C51 Microcontrollers


How to Build a Simple Serial Programmer Circuit for AT89C2051 and AT89C51 Microcontrollers

The AT89C2051 and AT89C51 are 8-bit microcontrollers from Atmel that are based on the 8051 architecture. They have 2 KB and 4 KB of flash memory respectively, and can be programmed using a serial interface. In this article, we will show you how to build a simple serial programmer circuit that can be used to program these microcontrollers using an Arduino board.

Components Required

  • An Arduino UNO board
  • An AT89C2051 or AT89C51 chip (DIP20 package)
  • A 20-pin ZIF socket
  • An optocoupler (preferably MOSFET-output)
  • An Arduino prototyping shield
  • A 12V power supply
  • A 5V power supply
  • A 16 MHz crystal oscillator
  • Two 30 pF capacitors
  • A 100 nF capacitor
  • A diode (ex: 1N400X)
  • Resistors (1K, 3K3)
  • A protoboard
  • Some jumpers and copper wire

Circuit Diagram


Components Required

The circuit diagram for the serial programmer is shown below. The AT89C2051 or AT89C51 chip is placed in the ZIF socket, which is connected to the Arduino pins through the optocoupler. The optocoupler isolates the microcontroller from the Arduino during programming, and prevents any damage to either device. The crystal oscillator and the capacitors provide the clock signal for the microcontroller. The diode and the resistor form a voltage divider that reduces the 12V supply to about 6V, which is applied to the EA/VPP pin of the microcontroller. This pin enables the programming mode when it is high, and disables it when it is low. The RST pin of the microcontroller is connected to the Arduino pin 10, which is used to reset the device before programming. The PSEN pin of the microcontroller is connected to the Arduino pin 9, which is used to enable the serial programming mode when it is low. The ALE/PROG pin of the microcontroller is connected to the Arduino pin 8, which is used to send programming pulses during data transfer. The RXD pin of the microcontroller is connected to the Arduino pin 0 (RX), which is used to receive data from the Arduino. The TXD pin of the microcontroller is connected to the Arduino pin 1 (TX), which is used to send data to the Arduino.

Circuit diagram

Programming Software


Circuit Diagram

To program the AT89C2051 or AT89C51 chip using this circuit, we need two software components: one for the Arduino board, and one for the PC.

The software for the Arduino board is called AT89_prog, and it is a sketch that implements a simple serial protocol for communicating with the microcontroller. It can be downloaded from this GitHub repository. To upload it to the Arduino board, follow these steps:

  1. Open the AT89_prog.ino file in Arduino IDE.
  2. Select your board type and port from Tools menu.
  3. Click on Upload button.

The software for the PC is called at89overlord, and it is a Python script that uses at89_prog sketch to program the microcontroller with an IntelHex file. It can be installed using pip command:

pip install at89overlord

To use it, follow these steps:

  1. Connect your Arduino board to your PC using a USB cable.
  2. Connect your 12V power supply to your circuit.
  3. Place your AT89C2051 or AT89C51 chip in