English
Language : 

UPD78F9500MA-CAC-A Datasheet, PDF (279/342 Pages) Renesas Technology Corp – 8-Bit Single-Chip Microcontrollers
CHAPTER 16 FLASH MEMORY
FlashVerify:
MOVW
HL,#WriteAdr ; Sets verify address
MOV
FLCMD,#02H
; Sets flash control command (internal verify 2)
MOV
A,H
MOV
FLAPH,A
; Sets verify start address
MOV
A,L
MOV
FLAPL,A
; Sets verify start address
MOV
A,D
MOV
FLAPHC,A
; Sets verify end address
MOV
A,E
MOV
FLAPLC,A
; Sets verify end address
CALL
!ModeOn
; Shift to self programming mode
; Execution of internal verify command
MOV
PFS,#00H
; Clears flash status register
MOV
WDTE,#0ACH
; Clears & restarts WDT
HALT
; Self programming is started
MOV
A,PFS
CMP
A,#00H
BNZ
$StatusError ; Checks internal verify error
; Performs abnormal termination processing when an error occurs
CALL
!ModeOff
; Shift to normal mode
BR
StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
MOV
MK0,#11111111B ; Masks all interrupts
MOV
FLCMD,#00H
; Clears FLCMD register
User’s Manual U18172EJ3V0UD
277