At89c2051 Programming Software
Theoretical part: This is one of the simplest programmers. It was designed using common components, with respect to simple construction.
The physical program memory space of the device, which is 2K for the AT89C2051. This should be the responsibility of the software programmer. For example, LJMP 7E0H would be a valid instruction for the AT89C2051 (with 2K of memory), whereas LJMP 900H would not. Branching instructions: LCALL, LJMP, ACALL, AJMP, SJMP, JMP @A+DPTR.
It connects directly to a PC parallel port. Software is written in Pascal, the new version uses the Turbo Vision user interface. It should work with no problem on the first try. Both software versions support so-called DEBUG mode, that should greatly simplify any troubleshooting. I have tested it on a 6x86 VX motherboard with on-board LPT port. We paid great attention to the timing routines, so it should work on any computer.
This programmer is a part of the LAB-51 system. It is completely independent, but it was developed as its component. The article that follows is the translation of what has been published in Elektroinzert 11,12/96. We are working on a reprint.
The ATMEL corporation, well-known for their FLASH and EEPROM memories, has created their own version of the 8051 series processors. The AT89C51, for example, is a modified version of the 'standard' 87C51, with a FLASH memory instead of EPROM.
In this article, I would like to present my programmer for a similar circuit in a 20-pin DIL package, AT89C2051. My objective was to build a simple programmer, that would be easy to make at home and would work without significant problems on the first try. Features of the AT89C2051 processor: • Compatible with Intel 8051 • 2kB of internal FLASH program memory (1000 write cycles) • Voltage range from 2.7 to 6 V • Fully statical operation • Clock 0 Hz to 24 MHz • Two-level data protection • 128 bytes of internal RAM • 15 programmable I/O pins • Two 16-bit counters/timers • Analog comparator • 5 interrupt sources • Programmable UART - (RS232) • 2 power-saving modes The only major inovation over standard 51-series processors is the analog comparator on pins P1.0 and P1.1. Its output is accessible to the software via the P3.6 bit. Data protection system is designed very well.
With the AT89C51, it is not even possible to transfer contents of the internal FLASH memory if an external memory with a special software is attached to it. The only disadvantage of this processor is a small and non-expandable program memory. The circuit is intended for simple applications, where room and number of wires are limited.
It's a pity it can't run just with a RC-circuit for clock signal generating, and that an OTP version is not available. That would make it a full-featured competition to the well-known PIC processors (RISC singlechip processors by Microchip), e.g. PIC16C54 and PIC16C84, as the price difference is getting smaller. According to our measurements, power consumption averages approximately 12 mA. The lowest power consumption can be achieved with clock frequency of 2 MHz, and amounts to about 6 mA for the processor itself (add 2mA for a miniature 7805).
There is no further significant power consumption drop at lower clock frequencies. If you need more exact specifications, the original datasheet in.PDF format, or visit. This is an outline of the programming algorithm: • Connect +5V to Vcc, set RST low, and wait at least 10 miliseconds. • Set RST high. Set PROG (P3.2) high. • Set the programming mode via pins P3.3, P3.4, P3.5, P3.7 • Set the instruction code at address 000H via port P1 • Set RST to +12V • Send a 1.2ms long low pulse to PROG (P3.2).
• Set RST to +5V. Optionally, set verification mode via bits P3.3, P3.4, P3.5, P3.7 and read the data from P1. • Increment address counter by pulsing XTAL1, set next instruction code via P1 • Repeat steps 5 to 8 until the 2kB boundary is reached, or until the whole file has been programmed into the chip. • Finish: XTAL1 low, RST low.
Disconnect power. Hint: Instead of waiting 1.2ms, you can alternatively check the status bit P3.1 RDY/BSY; it's supposed to be more reliable. Programming modes Pulse widths Timing diagram for programming and verification Practical part.
Desctription of the programmer: Control bits and data are connected to ATMEL via latches (circuits 574). Data reading and verification is controlled by 74157 circuit - four multiplexers, allowing to read 8 bits via four parallel port input bits. Current nibble (high or low) is determined by the state of the 6Q bit (pin 14) of the system latch 574. LEDs are used to decrease voltage and to indicate current process. The KF517 transistors switch the internal FLASH memory programming voltage on/off, D1 separates both voltages and protects the transistor switching +5V.
If you choose to use an external +5V and +12V power supply, don't use the stabilisers 7812 and 7805 - they would do nothing but increase consumption. In some cases, it's better to use a different design for the voltage switching part - see the end of this article. Construction: The programmer circuit has been realised on a double-sided printed circuit board. It is recommended to use a precision socket for the ATMEL 89C2051.