CHAPTER 16 FLASH MEMORY
User’s Manual U18172EJ2V0UD
246
An example of a program that performs a byte write in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashWrite:
MOV
FLCMD,#05H
; Sets flash control command (byte write)
MOV
FLAPH,#07H
; Sets address to which data is to be written, with
; FLAPH (block 7 is specified here)
MOV
FLAPL,#20H
; Sets address to which data is to be written, with
; FLAPL (address 20H is specified here)
MOV
FLW,#10H
; Sets data to be written (10H 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
;----------------------------