AT89C51RB2/RC2
API Call Description
Several Application Program Interface (API) calls are available for use by an application
program to permit selective erasing and programming of Flash pages. All calls are made
through a common interface, PGM_MTP. The programming functions are selected by
setting up the microcontroller’s registers before making a call to PGM_MTP at FFF0h.
Results are returned in the registers.
When several Bytes have to be programmed, it is highly recommended to use the Atmel
API “PROGRAM DATA PAGE” call. Indeed, this API call writes up to 128 Bytes in a sin-
gle command.
All routines for software access are provided in the C Flash driver available at Atmel’s
web site.
The API calls description and arguments are shown in Table 74.
Table 74. API Call Summary
Command
R1
A
DPTR0
DPTR1
Returned Value
Command Effect
ACC = Manufacturer
Id
READ MANUF ID
00h
XXh
0000h
XXh
Read Manufacturer identifier
READ DEVICE ID1
READ DEVICE ID2
READ DEVICE ID3
00h
00h
00h
XXh
XXh
XXh
0001h
0002h
XXh
XXh
XXh
ACC = Device Id 1
ACC = Device Id 2
ACC = Device Id 3
Read Device identifier 1
Read Device identifier 2
Read Device identifier 3
Erase block 0
0003h
DPH = 00h
DPH = 20h
DPH = 40h
Erase block 1
Erase block 2
ERASE BLOCK
01h
XXh
00h
ACC = DPH
Address of
byte to
Program one Data Byte in user Flash
program
Erase Software boot vector and boot status
byte. (SBV = FCh and BSB = FFh)
XXh
DPH = 00h
DPL = 00h
Set SSB level 1
Set SSB level 2
Set SSB level 0
DPH = 00h
DPL = 01h
PROGRAM SSB
05h
XXh
00h
ACC = SSB value
DPH = 00h
DPL = 10h
DPH = 00h
DPL = 11h
Set SSB level 1
New BSB
value
PROGRAM BSB
PROGRAM SBV
06h
06h
0000h
0001h
XXh
XXh
none
none
Program boot status byte
Program software boot vector
New SBV
value
READ SSB
READ BSB
READ SBV
07h
07h
07h
XXh
XXh
XXh
0000h
0001h
0002h
XXh
XXh
XXh
ACC = SSB
ACC = BSB
ACC = SBV
Read Software Security Byte
Read Boot Status Byte
Read Software Boot Vector
105
4180C–8051–12/03