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
MOV
<R>
MOV
DI
<R>
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
NOP
<R>
HALT
<R>
BT
<R>
FlashWrite:
MOVW
MOVW
FlashWriteLoop:
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
HALT
MOV
CMP
BNZ
INCW
MOVW
CMPW
BNC
314
CHAPTER 19 FLASH MEMORY
MK0,#11111111B
; Masks all interrupts
MK1,#11111111B
FLCMD,#00H
; Clears FLCMD register
; Configure settings so that the CPU clock ≥ 1 MHz
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
; PFCMD register control
FLPMC,#01H
; FLPMC register control (sets value)
FLPMC,#0FEH
; FLPMC register control (inverts set value)
FLPMC,#01H
; Sets self programming mode with FLPMC register control
; (sets value)
PFS.0,$ModeOnLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
HL,#DataAdrTop
; Sets address at which data to be written is located
DE,#WriteAdr
; Sets address at which data is to be written
FLCMD,#05H
; Sets flash control command (byte write)
A,D
FLAPH,A
; Sets address at which data is to be written
A,E
FLAPL,A
; Sets address at which data is to be written
A,[HL]
FLW,A
; Sets data to be written
WDTE,#0ACH
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks write error
; Performs abnormal termination processing when an error
; occurs
HL
; Address at which data to be written is located + 1
AX,HL
AX,#DataAdrBtm
; Performs internal verify processing
$FlashVerify
; if write of all data is completed
User's Manual U17446EJ3V1UD
Need help?
Do you have a question about the 78K0S/KB1+ and is the answer not in the manual?