CHAPTER 18 FLASH MEMORY
User’s Manual U16898EJ3V0UD
318
DI
ModeOnLoop:
MOV
PFS,#00H
; Clears flash status register
MOV
PFCMD,#0A5H
; PFCMD register control
MOV
FLPMC,#01H
; FLPMC register control (sets value)
MOV
FLPMC,#0FEH
; FLPMC register control (inverts set value)
MOV
FLPMC,#01H
; Sets self programming mode via FLPMC register control (sets
;
value)
MOV
A,PFS
CMP
A,#00H
BNZ
$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
RET
;---------------------------------------------------------------------
; Processing to shift to normal mode
;---------------------------------------------------------------------
ModeOff:
MOV
PFS,#00H
; Clears flash status register
MOV
PFCMD,#0A5H
; PFCMD register control
MOV
FLPMC,#00H
; FLPMC register control (sets value)
MOV
FLPMC,#0FFH
; FLPMC register control (inverts set value)
MOV
FLPMC,#00H
; Sets normal mode via FLPMC register control (sets value)
MOV
A,PFS
CMP
A,#00H
BNZ
$ModeOff
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
MOV
MK0,#INT_MK0
; Restores interrupt mask flag
MOV
MK1,#INT_MK1
EI
RET
;---------------------------------------------------------------------
;Data to be written
;---------------------------------------------------------------------
DataAdrTop:
DB XXH
DB XXH