CHAPTER 16 FLASH MEMORY
User’s Manual U18172EJ2V0UD
250
An example of a program that performs an internal verify in self programming mode is shown below.
•
Internal verify 1
;----------------------------
;START
;----------------------------
FlashVerify:
MOV
FLCMD,#01H
; Sets flash control command (internal verify 1)
MOV
FLAPH,#07H
; Set the number of block for which internal verify is
; performed, to FLAPH (Example: Block 7 is specified here)
MOV
FLAPL,#00H
; Sets FLAPL to 00H
MOV
FLAPHC,#07H
MOV
FLAPLC,#FFH
; Sets 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
;----------------------------
•
Internal verify 2
;----------------------------
;START
;----------------------------
FlashVerify:
MOV
FLCMD,#02H
; Sets flash control command (internal verify 2)
MOV
FLAPH,#07H
; Set the number of block for which internal verify is
; performed, to FLAPH (Example: Block 7 is specified here)
MOV
FLAPL,#00H
; Sets FLAPL to the start address for verify (Example: Address
; 00H is specified here)
MOV
FLAPHC,#07H
MOV
FLAPLC,#20H
; Sets FLAPLC to the end address for verify (Example: Address
; 20H is specified here)
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
;----------------------------