CHAPTER 19 FLASH MEMORY
User’s Manual U17446EJ3V1UD
320
CALL
!ModeOff
; Shift to normal mode
BR StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
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 via 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
RET
<R>
<R>
<R>
<R>
<R>
Содержание 78K0S/KB1+
Страница 2: ...User s Manual U17446EJ3V1UD 2 MEMO ...