CHAPTER 16 FLASH MEMORY
User’s Manual U18172EJ2V0UD
243
An example of a program that performs a block blank check in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashBlockBlankCheck:
MOV
FLCMD,#04H
; Sets flash control command (block blank check)
MOV
FLAPH,#07H
; Sets number of block for blank check (block 7 is specified
;
here)
MOV
FLAPL,#00H
; Fixes FLAPL to “00H”
MOV
FLAPHC,#07H
; Sets blank check block compare number (same value as that of
;
FLAPH)
MOV
FLAPLC,#0FFH
; Fixes FLAPLC to “FFH”
MOV
PFS,#00H
; Clears flash status register
MOV
WDTE,#0ACH
; Clears & restarts WDT
HALT
; Self programming is started
MOV
A,PFS
MOV
CmdStatus,A
; Execution result is stored in variable
; (CmdStatus = 0: normal termination, other than 0: abnormal
;
termination)
;----------------------------
;END
;----------------------------