English
Language : 

UPD78F9500MA-CAC-A Datasheet, PDF (273/342 Pages) Renesas Technology Corp – 8-Bit Single-Chip Microcontrollers
<R>
<R>
CHAPTER 16 FLASH MEMORY
An example of a program when the interrupt-disabled time (from erasure to blank check) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
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:
; Sets erase command
MOV
FLCMD,#03H
; Sets flash control command (block erase)
MOV
FLAPH,#07H
; Sets number of block to be erased (block 7 is specified here)
MOV
FLAPL,#00H
; Fixes FLAPL to “00H”
MOV
FLAPHC,#07H ; Sets erase block compare number (same value as that of FLAPH)
MOV
FLAPLC,#00H ; Fixes FLAPLC to “00H”
CALL
!ModeOn
; Shift to self programming mode
EraseRetry:
; Execution of erase 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
$RetryCheck ; Checks erase error
; Performs abnormal termination processing when an error
; occurs.
CALL
!ModeOff
; Shift to normal mode
; Sets blank check command
MOV
FLCMD,#04H
; Sets flash control command (block blank check)
MOV
FLAPH,#07H
; Sets block number for blank check (block 7 is specified here)
MOV
FLAPL,#00H
; Fixes FLAPL to “00H”
MOV
FLAPHC,#07H ; Sets blank check block compare number (same value as that of
; FLAPH)
MOV
FLAPLC,#0FFH ; Fixes FLAPLC to “FFH”
CALL
!ModeOn
; Shift to self programming mode
; Execution of blank check command
MOV
PFS,#00H
; Clears flash status register
MOV
WDTE,#0ACH
; Clears & restarts WDT
HALT
; Self programming is started
MOV
A,PFS
User’s Manual U18172EJ3V0UD
271