I couldn’t find an ISP (programmer) for the STC89C52RC that worked with modern versions of Windows. I found several programmers that work with other chips in the STC range.
I did find one that worked on Windows XP, and with some hacking got it to work with Windows 7; however I had no luck with Windows 10. In any case, it was a Chinese program, and as I don’t read that language, I just had to remember which controls to use.
I also found one that worked under Linux, from the command line. Using that source code as a guide I figured out how to write my own Windows version.
It’s pretty basic but all you really need. You select the COM port and the hex file you want to upload. Connect up to your chip with a 5-volt serial port such as an FTDI (or you can use an Arduino UNO or similar that has a 5V FTDI built-in).
Here’s the video showing how to use the Arduino UNO as a programmer. Here it’s being used to program a Banggood POV kit which uses an STC89C52RC chip – but you could obviously adapt the Arduino sketch and/or make a wiring harness to work with any STC89 board:
Here’s the Arduino sketch when you’re using the UNO as a programmer as shown in the video: Arduino sketch
Edit: the programmer program is now at V0.4 which fixes a few bugs and lets you switch the microcontroller to high speed (6T per machine cycle) or normal speed (12T per machine cycle).
Further Edit (August 2017): the programmer program is now at V0.5, and supports some different STC-chip bootloader firmware versions that previous versions did not.
If you’re not using the Arduino (which powers up the STC chip by itself when it detects activity on the serial port) then press the button to start the upload and then apply power to the target chip. There’s a progress bar indicator – it takes maybe ten seconds to program the chip.
I’ve tried it on Windows 10 and Windows 7. I’ve no reason to suspect that it won’t work with other versions of Windows.
Beware the fake Prolific serial chips that come in some USB-serial adapters and some cheap STC89C5x development boards. I have one of those boards. I found an old version of the driver that let me get the Prolific chip operating as a loop back device – it even worked under Windows 10. But it’s flaky and doesn’t work for programming the chip. I found the only way I could get the programmer to work reliably was to cut the tracks leading from the STC chip’s serial port to the Prolific chip and connect an FTDI interface to the STC chip instead.
You may also need to fit a pull-up resistor to the STC’s TxD pin – only try that if you think you’ve connected everything up properly but it’s still not working – something like 10K or 100K should do the trick. It depends on how much pull-up effect is already present on the RxD line of your serial interface and on the amount of stray capacitance present on your boards and cables.
Here is the link to download the install zip file for the programmer
Update: Ewald Burger (see comments below) encountered problems with the installation that he eventually traced to his AVAST virus scanner. If you encounter problems with the installation you may want to try temporarily disabling your virus scanner while installing.
Here’s the source code – unzip it to your ‘projects’ folder. It was done using the free version of Visual Studio 2015 source code
Leave a Reply