Here’s the software necessary to work the programmer board:
Here’s a screenshot of the program in operation. It should all be fairly self-explanatory. Please send me a comment if you have any problems or questions.
Update January 2024. Fixed a slight bug in the Arduino sketch. It only affected the reading of the chip when lock bit 2 (verify disabled) was set. When the lock bit is set, the program cannot be read out of the chip, and when a byte is read, the P1 outputs of the chip just float (high impedance state). After the update, the Arduino sets its pins connected to P1 in the INPUT_PULLUP mode when reading – so in the lock bit set case, all the bytes will read as 0xFF and the chip will be reported to appear empty. Previously, depending on what operations had been carried out before reading, the Arduino inputs could have been in INPUT, rather than INPUT_PULLUP mode – this gave inconsistent readings, usually 0xFE or 0xFC. Anyway, now fixed.
Update January 2021. Thanks to Marco Almeida, who built one of these gadgets, and reported errors when reading a program from the Chip. He solved the problem by reducing the baud rate at which the Arduino communicates with the PC program – previously it was 57600, and Marco reported that he’d had success at 9600. I was able to reproduce the bug at 57600 baud. I don’t know why it worked previously – I think maybe an update to the Arduino release, default optimization settings, etc, pushed it over the edge. Anyway, I found that mine worked reliably at 19200 baud, so I’ve now modified and uploaded both the Arduino Mega sketch, and the PC program to work at that new reduced speed. It’s still plenty fast enough, only taking a couple of seconds to write, read, or verify a program using all the AT89C2051’s flash memory. The download links haven’t changed, but if you installed the programs prior to January 2021, you should probably uninstall your old copy, and update to the current one.
To reliably program a chip, you need to use the Erase function first. I usually erase, then read the chip (to check it’s empty), then load the hex file, write it to the chip, verify, and power down. Very occasionally, I’ll get a verify error, but a second pass through the above sequence has always resulted in success, so far!
You can buy programmers for the AT89C2051 (and other similar chips) on AliExpress for less than twenty dollars, and if you just want to program chips, that’s an easier way to go!