English
Language : 

HD6433044 Datasheet, PDF (606/867 Pages) Hitachi Semiconductor – Hitachi Single-Chip Microcomputer
Sample Program for Erasing One Block: This program uses the following registers.
R0: Prewrite-verify and erase-verify fail counter
ER1: Stores address used in prewrite
ER2: Stores address used in prewrite and erase-verify
ER3: Stores address used in erase-verify
ER4: Timing loop counter
R5: Sets appropriate registers
R6: Sets appropriate registers
The values of #a, #c, #d, #e, #f, #g, and #h, in the program depend on the clock frequency. They
can be calculated as indicated in tables 18-14 and 18-15.
FLMCR: .EQU
EBR1: .EQU
EBR2: .EQU
TCSR: .EQU
FFFF40
FFFF42
FFFF43
FFFFA8
; #BLKSTR is top address of block to be erased
; #BLKEND is last address of block to be erased
MOV.L
#BLKSTR:32, ER1
MOV.L
#BLKEND:32, ER2
; ER1: top address of block to be erased
; ER2: last address of block to be erased
; Execute prewrite
PREWRT: MOV.W
#g,
R4
; Set wait counter
MOV.W
#4140, R6
;
MOV.B
LOOPR0: DEC.W
R6L,
#1,
@FLMCR:8 ; Set VPPE bit
R4
;
BPL
LOOPR0
;
;SET EBR1 or EBR2 bit of block to be erased
MOV.B
#**,
R5H
;
MOV.B
R5H,
@EBR* ; Set EBR*
PREWRN: SUB.B
R0H,
R0H
; R0: prewrite-verify fail count
MOV.W
#a,
E4
; Set initial prewrite loop counter value
PREWRS: MOV.B
#00,
R5H
; Write #00 data
MOV.B
R5H,
@ER1
;
MOV.W
#A579, R5
; Start watchdog timer
MOV.W
R5,
@TCSR:16 ;
MOV.W
E4,
R4
; Set prewrite loop counter
MOV.W
#4140, R6
;
MOV.B
R6H,
@FLMCR:8 ; Set P bit
LOOPR1: DEC.W
#1,
R4
; Prewrite
BPL
LOOPR1
;
MOV.B
R6L,
@FLMCR:8 ; Clear P bit
MOV.W
#A500, R5
; Stop watchdog timer
MOV.W
R5,
@TCSR:16 ;
MOV.W
#c ,
R5
; Set prewrite-verify loop counter
597