CHAPTER 19 FLASH MEMORY
User’s Manual U17446EJ3V1UD
314
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
MK1,#11111111B
MOV
FLCMD,#00H
; Clears FLCMD register
DI
ModeOnLoop:
; Configure settings so that the CPU clock
≥
1 MHz
MOV
PFS,#00H
; Clears flash status register
MOV
PFCMD,#0A5H
; PFCMD register control
MOV
FLPMC,#01H
; FLPMC register control (sets value)
MOV
FLPMC,#0FEH
; FLPMC register control (inverts set value)
MOV
FLPMC,#01H
; 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
; 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
; Sets flash control command (byte write)
MOV
A,D
MOV
FLAPH,A
; Sets address at which data is to be written
MOV
A,E
MOV
FLAPL,A
; Sets address at which data is to be written
MOV
A,[HL]
MOV
FLW,A
; Sets data to be written
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
INCW
HL
; Address at which data to be written is l 1
MOVW
AX,HL
CMPW
AX,#DataAdrBtm
; Performs internal verify processing
BNC
$FlashVerify
; if write of all data is completed
<R>
<R>
<R>
<R>
<R>
Содержание 78K0S/KB1+
Страница 2: ...User s Manual U17446EJ3V1UD 2 MEMO ...