NEC 78K0S/KA1+ User Manual page 317

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

Advertisement

; Setting internal verify command
FlashVerify:
MOVW
HL,#WriteAdr
MOV
FLCMD,#01H
MOV
A,H
MOV
FLAPH,A
MOV
A,L
MOV
FLAPL,A
MOV
A,D
MOV
FLAPHC,A
MOV
A,E
MOV
FLAPLC,A
CALL
!ModeOn
; Execution of internal verify command
MOV
PFS,#00H
MOV
WDTE,#0ACH
HALT
MOV
A,PFS
CMP
A,#00H
BNZ
$StatusError
CALL
!ModeOff
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
CHAPTER 18 FLASH MEMORY
; Sets verify address
; Sets flash control command (internal verify)
; Sets verify start address
; Sets verify start address
; Sets verify end address
; Sets verify end address
; Shift to self programming mode
; Clears flash status register
; Clears & restarts WDT
; Self programming is started
; Checks internal verify error
; Performs abnormal termination processing when an error occurs
; Shift to normal mode
User's Manual U16898EJ3V0UD
317

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents