English
Language : 

UPD78F9500MA-CAC-A Datasheet, PDF (266/342 Pages) Renesas Technology Corp – 8-Bit Single-Chip Microcontrollers
CHAPTER 16 FLASH MEMORY
An example of a program when the command execution time (from erasure to black check) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
MOV
MK0,#11111111B ; Masks all interrupts
MOV
FLCMD,#00H
; Clears FLCMD register
DI
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
PFCMD,#0A5H
FLPMC,#01H
FLPMC,#0FEH
FLPMC,#01H
; Configure settings so that the CPU clock ≥ 1 MHz
; Clears flash status register
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode with FLPMC register control (sets
; value)
NOP
HALT
BT PFS.0,$ModeOnLoop
FlashBlockErase:
MOV
FLCMD,#03H
MOV
FLAPH,#07H
MOV
FLAPL,#00H
MOV
FLAPHC,#07H
MOV
FLAPLC,#00H
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs.
; 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”
MOV
HALT
MOV
CMP
BNZ
WDTE,#0ACH
A,PFS
A,#00H
$StatusError
; Clears & restarts WDT
; Self programming is started
; Checks erase error
; Performs abnormal termination processing when an error
; occurs.
FlashBlockBlankCheck:
MOV
FLCMD,#04H
MOV
FLAPH,#07H
MOV
FLAPL,#00H
; Sets flash control command (block blank check)
; Sets number of block for blank check (block 7 is specified
; here)
; Fixes FLAPL to “00H”
MOV
FLAPHC,#07H
; Sets blank check block compare number (same value as of
; FLAPH)
264
User’s Manual U18172EJ3V0UD