NEC 78K0S/KA1+ User Manual page 316

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

Advertisement

An example of a program when the interrupt-disabled time (from write to internal verify) should be minimized in self
programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
; Sets write command
FlashWrite:
MOVW
HL,#DataAdrTop ; Sets address at which data to be written is located
MOVW
DE,#WriteAdr
FlashWriteLoop:
MOV
FLCMD,#05H
MOV
A,D
MOV
FLAPH,A
MOV
A,E
MOV
FLAPL,A
MOV
A,[HL]
MOV
FLW,A
CALL
!ModeOn
; Execution of write command
MOV
PFS,#00H
MOV
WDTE,#0ACH
HALT
MOV
A,PFS
CMP
A,#00H
BNZ
$StatusError
CALL
!ModeOff
MOV
MK0,#INT_MK0
MOV
MK1,#INT_MK1
EI
; Judgment of writing all data
INCW
HL
MOVW
AX,HL
CMPW
AX,#DataAdrBtm ; Performs internal verify processing
BNC
$FlashVerify
INCW
DE
BR
FlashWriteLoop
316
CHAPTER 18 FLASH MEMORY
; Sets address at which data is to be written
; Sets flash control command (byte write)
; Sets address at which data is to be written
; Sets address at which data is to be written
; Sets data to be written
; Shift to self programming mode
; Clears flash status register
; Clears & restarts WDT
; Self programming is started
; Checks write error
; Performs abnormal termination processing when an error
; occurs.
; Shift to normal mode
; Restores interrupt mask flag
; Address at which data to be written is located + 1
; if write of all data is completed
; Address at which data is to be written + 1
User's Manual U16898EJ3V0UD

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents