English
Language : 

UPD78F9500MA-CAC-A Datasheet, PDF (269/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 write to internal verify) 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
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs.
FlashWrite:
MOVW
HL,#DataAdrTop
MOVW
DE,#WriteAdr
FlashWriteLoop:
MOV
FLCMD,#05H
MOV
A,D
MOV
FLAPH,A
MOV
A,E
MOV
FLAPL,A
MOV
A,[HL]
MOV
FLW,A
; Sets address at which data to be written is located
; Sets address at which data is to be written
; Sets flash control command (byte write)
; Sets address at which data is to be written
; Sets address at which data is to be written
; Sets data to be written
MOV
HALT
MOV
CMP
BNZ
WDTE,#0ACH
A,PFS
A,#00H
$StatusError
; Clears & restarts WDT
; Self programming is started
; Checks write error
; Performs abnormal termination processing when an error
; occurs.
INCW
MOVW
CMPW
BNC
HL
AX,HL
AX,#DataAdrBtm
$FlashVerify
; address at which data to be written is located + 1
; Performs internal verify processing
; if write of all data is completed
User’s Manual U18172EJ3V0UD
267