
P89V52X2_3
NXP B.V. 2009. All rights reserved.
Product data sheet
Rev. 03 — 4 May 2009
37 of 57
NXP Semiconductors
P89V52X2
80C51 with 256 B RAM, 192 B data EEPROM
An assembly language routine to load the page register and perform an erase/program
operation is shown below. This code assumes the data EEPROM has been mapped into
user code space.
;**************************************************
;*
pgm user code
*
;**************************************************
;*
*
;* Inputs:
*
;*R3 = number of bytes to program (byte)
*
;*R4 = page address MSB(byte)
*
;*R5 = page address LSB(byte)
*
;*R7 = pointer to data buffer in RAM(byte)
*
;* Outputs:
*
;*R7 = status (byte)
*
;* C = clear on no error, set on error
*
;**************************************************
Table 34.
Flash Memory Control register (FMCON - address E4H) bit description
Bit
Symbol
Access
Description
0
ERR
R
Set when either of the following conditions occur:
Device was reset before the operation was completed.
Attempt made to access data EEPROM while Data Access Protect (DAP) is set.
An error occurs in the device’s internal high voltage circuits.
FMCMD.0
W
Command byte bit 0.
1
SV
R
Security violation. Set when an attempt is made to program, erase, or CRC a secured page.
The specic cause of the security violation depends on the operation:
PROG or EP: CSEC.0 = 1 or DPxSEC.1 = 1 for the page addressed by FMADRH/L.
ERS_G: Any DPxSEC.0 = 1.
ERS_DP: DPxSEC.2 = 1 for addressed page while in execution mode.
CRC_DP: DPxCSEC.0 = 1 and DPxSEC.1 = 0.
FMCMD.1
W
Command byte bit 1
2
-
R
Reserved
FMCMD.2
W
Command byte bit 2.
3
-
R
Reserved
FMCMD.3
W
Command byte bit 3.
4
DAP
R
Data Access Protect. When set, access to the data EEPROM is unmapped and thus
prohibited. Set by the MAP command. Cleared by the UNMAP command.
FMCMD.4
W
Command byte bit 4.
5
-
R
Reserved
FMCMD.5
W
Command byte bit 5.
6
WE
R
When set, indicates that data EEPROM writes during program execution are enabled.
FMCMD.6
W
Command byte bit 6.
7
BUSY
R
Indicates that a program, erase, CRC calculation or similar operation is in progress. Note that
this bit is usable only in ICP mode since the CPU is stalled whenever this bit is set in execution
mode.
FMCMD.7
W
Command byte bit 7.