NEC 78K0S/KB1+ User Manual page 326

8-bit single-chip microcontrollers
Hide thumbs Also See for 78K0S/KB1+:
Table of Contents

Advertisement

;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
MOV
MOV
<R>
MOV
DI
<R>
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
NOP
<R>
<R>
HALT
<R>
BT
RET
;---------------------------------------------------------------------
; Processing to shift to normal mode
;---------------------------------------------------------------------
ModeOffLoop:
MOV
<R>
MOV
MOV
MOV
MOV
MOV
<R>
BT
MOV
MOV
EI
RET
326
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 via FLPMC register control (sets
; value)
PFS.0,$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
FLCMD,#00H
; Clears FLCMD register
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
; PFCMD register control
FLPMC,#00H
; FLPMC register control (sets value)
FLPMC,#0FFH
; FLPMC register control (inverts set value)
FLPMC,#00H
; Sets normal mode via FLPMC register control (sets value)
PFS.0,$ModeOffloop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
; Restore the CPU clock to its setting before the self
; programming, after normal completion of the specific
; sequence
MK0,#INT_MK0
; Restores interrupt mask flag
MK1,#INT_MK1
User's Manual U17446EJ3V1UD

Advertisement

Table of Contents
loading

Table of Contents