NEC 78K0S/KA1+ User Manual page 303

8-bit single-chip microcontrollers
Hide thumbs Also See for 78K0S/KA1+:
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
MK0,#11111111B
MOV
MK1,#11111111B
DI
ModeOnLoop:
MOV
PFS,#00H
MOV
PFCMD,#0A5H
MOV
FLPMC,#01H
MOV
FLPMC,#0FEH
MOV
FLPMC,#01H
MOV
A,PFS
CMP
A,#00H
BNZ
$ModeOnLoop
FlashBlockErase:
MOV
FLCMD,#03H
MOV
FLAPH,#07H
MOV
FLAPL,#00H
MOV
FLAPHC,#07H
MOV
FLAPLC,#00H
MOV
WDTE,#0ACH
HALT
MOV
A,PFS
CMP
A,#00H
BNZ
$StatusError
FlashBlockBlankCheck:
MOV
FLCMD,#04H
MOV
FLAPH,#07H
MOV
FLAPL,#00H
CHAPTER 18 FLASH MEMORY
; Masks all interrupts
; Clears flash status register
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode with FLPMC register control (sets
; value)
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
; Sets flash control command (block erase)
; Sets number of block to be erased (block 7 is specified
; here)
; Fixes FLAPL to "00H"
; Sets erase block compare number (same value as that of
; FLAPH)
; Fixes FLAPLC to "00H"
; Clears & restarts WDT
; Self programming is started
; Checks erase error
; Performs abnormal termination processing when an error
; occurs.
; Sets flash control command (block blank check)
; Sets number of block for blank check (block 7 is specified
; here)
; Fixes FLAPL to "00H"
User's Manual U16898EJ3V0UD
303

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents