English
Language : 

UPD78F9500MA-CAC-A Datasheet, PDF (278/342 Pages) Renesas Technology Corp – 8-Bit Single-Chip Microcontrollers
CHAPTER 16 FLASH MEMORY
An example of a program when the interrupt-disabled time (from write to internal verify) should be minimized in self
programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
; Sets write command
FlashWrite:
MOVW
HL,#DataAdrTop ; Sets address at which data to be written is located
MOVW
DE,#WriteAdr ; Sets address at which data is to be written
FlashWriteLoop:
MOV
FLCMD,#05H
MOV
A,D
MOV
FLAPH,A
MOV
A,E
MOV
FLAPL,A
MOV
A,[HL]
MOV
FLW,A
; 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
CALL
!ModeOn
; Shift to self programming mode
; Execution of write 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 write error
; Performs abnormal termination processing when an error
; occurs.
CALL
!ModeOff
; Shift to normal mode
MOV
MK0,#INT_MK0 ; Restores interrupt mask flag
EI
; Judgment of writing all data
INCW
HL
; Address at which data to be written is located + 1
MOVW
AX,HL
CMPW
AX,#DataAdrBtm ; Performs internal verify processing
BNC
$FlashVerify ; if write of all data is completed
INCW
BR
DE
; Address at which data is to be written + 1
FlashWriteLoop
276
; Setting internal verify command
User’s Manual U18172EJ3V0UD