CHAPTER 19 FLASH MEMORY
User’s Manual U17446EJ3V1UD
309
Example programs that perform internal verify 1 and 2 in self programming mode are shown below.
•
Internal verify 1
;----------------------------
;START
;----------------------------
FlashVerify:
MOV
FLCMD,#01H
; Sets flash control command (internal verify 1)
MOV
FLAPH,#07H
; Sets block number for which internal verify is performed,
; to FLAPH (Example: Block 7 is specified here)
MOV
FLAPL,#00H
; Sets 00H
MOV
FLAPHC,#07H
MOV
FLAPLC,#FFH
; Sets 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
; Sets block number 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
;----------------------------
<R>
<R>
Содержание 78K0S/KB1+
Страница 2: ...User s Manual U17446EJ3V1UD 2 MEMO ...