From ElectroDragon
(Redirected from STC)
Jump to navigation Jump to search


Keil C51 Setup

  • Click the thumbnail to see large GIF animation tutorial
  • Notice to install Keil C51 and MDK-ARM in different folder
  • Add MCU list from STC-ISP into Keil C51
  • Add header file, optionally maybe name it to STC15.h, or any


  • install sdcc: apt-get install sdcc
  • complie .c file: sdcc main.c, then pack ihx, packihx stc.ihx > stc.hex
  • replace reg51.h by 8051.h header

Multi-file project

SDCC does not support the simultaneous translation of multiple source files, so the compilation of multiple file projects need to be carried out step by step.If your project contains foo1.c foo2.c main.c three files, then the compilation process is as follows:

  • Sdcc -c foo1.c
  • Sdcc -c foo2.c
  • Sdcc main.c foo1.rel foo2.rel

You can also compile using the following methods:

  • Sdcc -c main.c
  • Sdcc main.rel foo1.rel foo2.rel

Finally, you can deal with the ihx file. For multi-file project is best to write a makefile file with make to maintain or write a batch file.

Flashing Downloader


  • STCMCU, download STC-ISP, header file, simulation file.
  • Flash in Linux use stcgal: python stcgal.py -P stc15 led.hex -b 1200, stc15 can only work on a low speed
  • gstc-isp in linux
  • stcflash in linux


  • Once you have programmer pluged in, you should see the programm status is "colorful" with corrected programmer name.
  • This is the version 1.72, support usbasp, but not usbtinyisp, seems more powerful.

Flash STC

IC List, Datasheet

ICs Package Price
STC15F104 SO8 1.5
STC89C51 DIP40 3.2
STC15W408AS SO16 2.5
STC15F2K60S2-28I-LQFP44G LQFP44 5.2

STC15 series english


Demo Code

  • C51 (mostly in Chinese)