English
Language : 

UPD78F9500MA-CAC-A Datasheet, PDF (254/342 Pages) Renesas Technology Corp – 8-Bit Single-Chip Microcontrollers
CHAPTER 16 FLASH MEMORY
An example of a program that performs a block erase in self programming mode is shown below.
;----------------------------
;START
;----------------------------
<R>
MOV
B,#48
; Specifies the number of times the erase command can be
; executed.
; (4.0 V to 5.5 V Time for executing block erasure 100 times)
FlashBlockErase:
MOV
FLCMD,#03H
MOV
FLAPH,#07H
MOV
FLAPL,#00H
MOV
FLAPHC,#07H
MOV
FLAPLC,#00H
; Sets flash control command (block erase)
; Sets number of block to be erased (block 7 is specified here)
; Fixes FLAPL to “00H”
; Sets erase block compare number (same value as that of FLAPH)
; Fixes FLAPLC to “00H”
<R>
EraseRetry:
MOV
MOV
HALT
MOV
CMP
BZ
DBNZ
PFS,#00H
; Clears flash status register
WDTE,#0ACH
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
; Checks execution result
$StatusNormal ; Normal termination
B,$EraseRetry ; Checks whether to re-execute the erase command.
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
252
User’s Manual U18172EJ3V0UD