STC12C5Axx
Technical Summary
69
In System Programming and In Application Programming
In System Programming (ISP)
To develop a good program for ISP function, the user has to understand the architecture of the
embedded flash.
The embedded flash consists of 16 pages. Each page contains 512 bytes.
Dealing with flash, the user must erase it in page unit before writing (programming) data into
it.
Erasing flash means setting the content of that flash as
FF
h. Two erase modes are available
in this chip. One is
mass mode
and the other is
page mode
. The
mass mode
gets more
performance, but it erases the entire flash. The page mode is something performance less,
but it is flexible since it erases flash in page unit.
Unlike RAM’s real-time operation, to erase flash or to write (program) flash often takes long
time so to wait finish.
Furthermore, it is a quite complex timing procedure to erase/program flash. Fortunately, the
STC12C5Axx carried with convenient mechanism to help the user read/change the flash
content. Just filling the target address and data into several SFR, and triggering the built-in
ISP automation, the user can easily erase, read, and program the embedded flash.
There are several SFR designed to help the user implement the ISP functionality.
SFR:
IAP_DATA (ISP Flash Data register)
Bit-7 Bit-6 Bit-5 Bit-4 Bit-3 Bit-2 Bit-1 Bit-0
Data to be written into flash, or data got from flash
IFD is the data port register for ISP/IAP operation. The data in IFD will be written into the desired
address in operating ISP write and it is the data window of readout in operating ISP read.
SFR:
IAP_ADDRH (ISP Flash Address High byte)
Bit-7 Bit-6 Bit-5 Bit-4 Bit-3 Bit-2 Bit-1 Bit-0
Must be cleared to 000
ISP/IAP address High byte
IFADRH is the high byte address for all ISP/IAP operation.
Against in advertise effect, if one bit of IFADRH [7:5] is set, the ISP write function must fail.
SFR:
IAP_ADDRL (ISP Flash Address Low byte)
Bit-7 Bit-6 Bit-5 Bit-4 Bit-3 Bit-2 Bit-1 Bit-0
ISP/IAP address Low byte
IFADRL is the low byte address for all ISP/IAP operation.
SFR:
IAP_CMD (ISP Flash-operating Mode Table)
Bit-7 Bit-6 Bit-5 Bit-4 Bit-3 Bit-2 Bit-1 Bit-0
- - - - - -
Mode Selection
http://www.DataSheet4U.net/
datasheet pdf - http://www.DataSheet4U.net/