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
01h
XXh
00h
ACC = DPH
Erase block 1
Erase block 2
Address of
byte to
program
PROGRAM DATA
BYTE
Program up one data byte in the on-chip
flash memory.
02h Vaue to write
XXh
ACC = 0: DONE
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
Program up to 128 bytes in user Flash.
Address of
the first byte
to program in
the Flash
Address in
XRAM of the
first data to
program
Number of
byte to
program
Remark: number of bytes to program is
limited such as the Flash write remains in a
single 128 bytes page. Hence, when ACC
is 128, valid values of DPL are 00h, or, 80h.
ACC = 0: DONE
PROGRAM DATA
PAGE
09h
memory
105
4180E–8051–10/06