STC TECHNOLOGY Co.,Ltd.
STC12C5A08/16/32/60
8-bit micro-controller
This document contains information on a new product under development by STC.STC reserves the right to change or discontinue this
product without notice. 2007/12 version A1
Procedures demonstrating ISP function
IAP_CMD
←
xxxxx
011
B
/* choice page-erasing command */
IAP_CONTR
←
100xx010
B
/* set ISPEN=1 to enable flash change.
set WAIT=010, 10942 MC; assumed 10M X’s*/
IAP_ADDRH
←
(page address high byte)
/* specify the address of the page to be erased */
IAP_ADDRL
←
(page address low byte)
IAP_TRIG
←
5Ah
/* trig IAP activity */
IAP_TRIG
←
A5h
(CPU progressing will be hold here )
(CPU continues)
Erase a specific flash page
IAP_CMD
←
xxxxx
010
B
/* choice byte-programming command */
IAP_CONTR
←
100xx010
B
/* set ISPEN=1 to enable flash change.
set WAIT=010, 60 MC; assumed 10M
X’s*/
IAP_ADDRH
←
(Address high byte)
/* specify the address to be programmed */
IAP_ADDRL
←
(Address low byte)
IAP_DATA
←
(byte date to be written into flash)
/* prepare data source */
IAP_TRIG
←
5Ah
/* trig IAP activity */
IAP_TRIG
←
A5h
(CPU progressing will be hold here)
(CPU continues)
Program a byte into flash
IAP_CMD
←
xxxxx
001
B
/* choice byte-read command */
IAP_CONTR
←
100xx010
B
/* set IAPEN=1 to enable flash change.
set WAIT=010, 11 MC; assumed 10M X’s*/
IAP_ADDRH
←
(Address high byte)
/* specify the address to be read */
IAP_ADDRL
←
(Address low byte)
IAP_TRIG
←
5Ah
/* trig ISP activity */
IAP_TRIG
←
A5h
(CPU progressing will be hold here)
(CPU continues and currently
IAP_DATA
contain the desired data byte )
Read a byte from flash
http://www.DataSheet4U.net/
datasheet pdf - http://www.DataSheet4U.net/