UM10346_1
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 01 — 2 November 2009
108 of 132
NXP Semiconductors
UM10346
LPC980/982 User manual
An assembly language routine to load the page register and perform an erase/program
operation is shown below.
;**************************************************
;*
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
*
;**************************************************
LOAD
EQU
00H
EP
EQU
68H
PGM_USER:
MOV
FMCON,#LOAD
;load command, clears page register
MOV
FMADRH,R4
;get high address
MOV
FMADRL,R5
;get low address
MOV
A,R7
;
MOV
R0,A
;get pointer into R0
LOAD_PAGE:
MOV
FMDAT,@R0
;write data to page register
INC
R0
;point to next byte
DJNZ
R3,LOAD_PAGE
;do until count is zero
MOV
FMCON,#EP
;else erase & program the page
Table 94.
Flash Memory Control register (FMCON - address E4h) bit description
Bit Symbol
Access
Description
0
OI
R
Operation interrupted. Set when cycle aborted due to an interrupt or reset.
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 sector or
page.
FMCMD.1
W
Command byte bit 1
2
HVE
R
High voltage error. Set when an error occurs in the high voltage generator.
FMCMD.2
W
Command byte bit 2.
3
HVA
R
High voltage abort. Set if either an interrupt or BOD FLASH is detected during a program or
erase cycle.
FMCMD.3
W
Command byte bit 3.
4:7
-
R
reserved.
4
FMCMD.4
W
Command byte bit 4.
5
FMCMD.5
W
Command byte bit 5.
6
FMCMD.6
W
Command byte bit 6.
7
FMCMD.7
W
Command byte bit 7.