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.
Table 74. API Call Summary
Command
R1
The API calls description and arguments are shown in Table 74.
A
DPTR0
DPTR1
Returned Value Command Effect
READ MANUF ID
00h
XXh
0000h
XXh
ACC=Manufacturer
ID
Read Manufacturer identifier
READ DEVICE ID1 00h
XXh
0001h
XXh
ACC= Device ID 1 Read Device identifier 1
READ DEVICE ID2 00h
XXh
0002h
XXh
ACC=Device ID 2 Read Device identifier 2
READ DEVICE ID3 00h
XXh
0003h
XXh
ACC=Device ID 3 Read Device identifier 3
DPH = 00h
Erase block 0 (from 0x0000 to 0x1FFF)
DPH=20h
ERASE BLOCK
01h
XXh
00h
DPH=40h
ACC=DPH
Erase block 1 (from 0x2000 to 0x3FFF)
Erase block 2 (from 0x4000 to 0x7FFF)
(AT89C51RC2 device only)
PROGRAM DATA
BYTE
02h
Byte value to
program
Address of
Byte to
program
ACC = 0 : DONE
Program one Data Byte in user Flash
ERASE BOOT
VECTOR
04h
XXh
XXh
XXh
ACC=FCh
Erase Software boot vector and boot status
Byte. (SBV=FCh and BSB=FFh)
DPH = 00h
DPL = 00h
Set SSB level 1
DPH = 00h
DPL = 01h
PROGRAM SSB
05h
XXh
00h
DPH = 00h
DPL = 10h
ACC= SSB value
Set SSB level 2
Set SSB level 0
DPH = 00h
DPL = 11h
Set SSB level 1
PROGRAM BSB
06h
New BSB
value
0000h
XXh
none
Program boot status Byte
PROGRAM SBV
06h
New SBV
value
0001h
XXh
none
Program software boot vector
READ SSB
07h
XXh
0000h
XXh
ACC=SSB
Read Software Security Byte
READ HSB
07h
XXh
0004h
XXh
ACC=HSB
Read Hardware Byte
READ BSB
07h
XXh
0001h
XXh
ACC=BSB
Read Boot Status Byte
READ SBV
07h
XXh
0002h
XXh
ACC=SBV
Read Software Boot Vector
4180B–8051–04/03
103