0% found this document useful (0 votes)
25 views

STC Programming

STC programming
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

STC Programming

STC programming
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

TB230621S45

:‫البرامج المطلوبة لبرمجة ورفع االكواد‬ -1


C51V961.EXE 
stc-isp-v6.91K.exe 

Software Tools
Only two software tools will be needed. The first is Keil C51 compiler and
second STC ISP tool

STC ISP tool can be downloaded from here. This is one helluva tool that has
many useful features. It a programmer interface, a code generator, serial port
monitor, code bank and many other stuffs. It sure does make coding STC
micros lot easier than you can possibly imagine.
Keil C51 C compiler will be needed to code STC micros. At present, Keil is the
only C compiler that can be used reliably to code STC micros. STC
documentations speak of Keil mostly. If you want to use some other compiler
like IAR Embedded Workbench, MikroC for 8051, etc other than Keil, your
have to add the SFR definitions of your target STC micros and do other stuffs
to familiarize it with the STC micro target. Alternatively, you can use models
of other similar 8051 model.

Programming STC
Microcontrollers
By default, STC microcontroller database is absent in Keil. It is imperative
that this database is added to Keil when using it for STC micros for the very
first time. Though this database is not complete in the sense that not chips
are enlisted in it, it is still a must or else we will have to use unconventional
coding methods by using models of similar microcontrollers of different
manufacturers. Personally, I hate unconventional tactics because why use
such methods when we can add the database easily. We only have to add
this database once.

First run the STC-ISP tool.


After clicking the STC-ISP tool icon,
the application starts and the following window appears:

Once the application starts, navigate to Keil ICE Settings tab and locate the
highlighted button as shown below:
Now just navigate to Keil installation folder and hit OK as shown below:

Selecting wrong folder will end up with an error and the database won’t be
installed.

If the database addition is a success, you’ll get the following message:


Now run Keil C51 compiler
Give your project a folder and a name as shown below:

Select STC Database and appropriate chip or similar part number.


After chip selection, add the startup assembler file to your project.

By default, Keil doesn’t add/create any file and so you’ll see that the project
folder has no main source file. We’ll have to create one main source file and
add additional files if needed.

Still we are not ready to start coding. This is because we have not yet added
SFR definition header file and other custom optional files.

Again, we need to take the help of STC-ISP tool.

In STC-ISP tool, locate the Header File tab and select appropriate MCU
series.
Save or copy the file to your desired location.

In Keil, go to target options by right click the folder icon and set target
options as shown in the following screenshots:
From this window select clock frequency and memory model.
Select Create HEX File from this window as this file will be uploaded in the
target chip.

This section above is highly important because here we have to show the
compiler the locations of the header or include files. Check the step
numbering carefully
Lastly disable Warning Number 16. Now, we are good to code.

I made a small Youtube video on all the above discussed processes. If you
didn’t understand some part or if you are confused at some point, you can
watch the video here.

You might also like