NEC 78K0S/KB1+ User Manual page 311

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

Advertisement

An example of a program when the command execution time (from erasure to black check) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
MOV
MOV
<R>
MOV
DI
ModeOnLoop:
<R>
MOV
MOV
MOV
MOV
MOV
NOP
<R>
HALT
<R>
BT
<R>
FlashBlockErase:
MOV
MOV
MOV
MOV
MOV
MOV
HALT
MOV
CMP
BNZ
FlashBlockBlankCheck:
MOV
MOV
MOV
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
FLCMD,#03H
; Sets flash control command (block erase)
FLAPH,#07H
; Sets number of block to be erased (block 7 is specified
; here)
FLAPL,#00H
; Fixes FLAPL to "00H"
FLAPHC,#07H
; Sets erase block compare number (same value as that of
; FLAPH)
FLAPLC,#00H
; Fixes FLAPLC to "00H"
WDTE,#0ACH
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks erase error
; Performs abnormal termination processing when an error
; occurs
FLCMD,#04H
; Sets flash control command (block blank check)
FLAPH,#07H
; Sets number of block for blank check (block 7 is specified
; here)
FLAPL,#00H
; Fixes FLAPL to "00H"
User's Manual U17446EJ3V1UD
311

Advertisement

Table of Contents
loading

Table of Contents