Programming STC MCU

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Design and development

Dr. C.K Chan



MECH 3012

Workshop 11

STC MCU: ISP Programming







Department of Mechanical Engineering
The University of Hong Kong


Workshop 11 STC MCU: ISP programming

1

Table of content
1. Introduction ...................................................................................... 2
2. General procedures for ISP programming ...................................... 4
2.1. Prepare *.hex file .................................................................... 5
2.2. Connect cable to the Development board .............................. 8
2.3. Execute ISP program .............................................................. 9




Workshop 11 STC MCU: ISP programming

2
1. Introduction
STC12C5A60S2 is a single-chip microcontroller based on a high
performance 1T architecture 80C51 CPU, which is produced by STC MCU
Limited.
With the enhanced kernel, STC12C5A60S2 executes instructions in 1~6
clock cycles (about 6~7 times the rate of a standard 8051 device), and has a
fully compatible instruction set with industrial-standard 80C51 series
microcontroller.

In-System-Programming (ISP) and In-Application Programming (IAP)
support the users to upgrade the program and data in system.

It allows the user to download new code
without removing the microcontroller from
the actual end product;
ISP
It means that the device can write non-
valatile data in Flash memory while the
application program is running.
IAP

Workshop 11 STC MCU: ISP programming

3
The STC12C5A60S2 retains all features of the standard 80C51. In addition,
the STC12C5A60S2 has:
1) Two extra I/O ports (P4 and
P5: package depend),
2) A 10-sources (4 priority-level
interrupt structure),
3) 10-bit ADC,
4) Two UARTS,
5) On-clip crystal oscillator,
(for ISP programming)
6) A 2-channel PCA and
PWM,
7) SPI,
8) A one-time enabled
Watchdog Timer.
STC12C5A60S2 series Selection Table is given below:

The STC company also provide MCUs of low cost as AT89S52, such as STC89C51RC.

Workshop 11 STC MCU: ISP programming

4


2. General procedures for ISP programming
Some development boards require STC series MCU to be
cool boot during ISP programming process.


1) Prepare
*.hex file
2) Connect
cable
3) Execute ISP
program
4) Select COM
port
5) Select MCU
type
6) Open *.hex
file
7) Turn off
power to MCU
8) Press
download
button
9) Turn on
power to MCU

Workshop 11 STC MCU: ISP programming

5
2.1. Prepare *.hex file
Replace the file c:/Keil/UV4/uv4.cdb with the file provided in my web site
(www.hku.hk/mech/compapp) to add the MCU selection list.

Select the right project option:


Workshop 11 STC MCU: ISP programming

6



STC12C5A60S2
No

Workshop 11 STC MCU: ISP programming

7
Download the header file for STC12C5A60S2 to your project folder from
my Web site.

Include this header file to your program. You should use this header file
only instead of others which provide definition of variables for the STC
MCU. It also contains definition of tradition 8051 MCU.
#include stc_new_8051.h
..
main( )
{}
Write and build your program with Keil vision.


Workshop 11 STC MCU: ISP programming

8
2.2. Connect cable to the Development board
Depends on the design of the development board, you may need to use
different types of cable.
You need to install the corresponding driver for the development board.


Power supply and
program download
Single USB
USB: Power supply
USBRS232: Program
download
USB +
USBRS232
Single USB

Workshop 11 STC MCU: ISP programming

9


2.3. Execute ISP program
Download the ISP program from my web site. Both program can be
executed without installation.

STC4.88
Support winXP, win7-32bit
English interface
PzISP
Support winXP, win7
32/64 bit
Simplified chinese
interface
USBRS232
USB power supply
USBRS232
USB

Workshop 11 STC MCU: ISP programming

10
For STC-ISP 4.88

1) Select MCU

2) Open code file (*.hex)

3) Select COM port and baud rate
1
4
3
5
6
7
2


Workshop 11 STC MCU: ISP programming

11

How to check the COM port?
Under Window7 control panel System & security System
Device manager COM & LPT.
4) Set max/min Baud rate to baud rate the same as the COM port. If it
is not success. Try lower baud rate, say 1200.

5) Select On-Clip R/C clock

6) Turn off MCU power
7) Press ISP programing button



Workshop 11 STC MCU: ISP programming

12

8) Turn on MCU power
9) Wait

For PzISP


4
5
1
2
3

Workshop 11 STC MCU: ISP programming

13
1) Select MCU type

2) Set COM port

3) Set baud rate to the port setting. Use low speed download. If it is not
success in later step, try 1200 here.

4) Open *.hex




Workshop 11 STC MCU: ISP programming

14

5) Turn off the MCU board.
6) Download program

7) Turn on the MCU board just after press the download program button.
8) You should see the following screen.

You might also like