Hitachi H8/3048 Hardware Manual page 606

Single-chip microcomputer
Table of Contents

Advertisement

Sample Program for Erasing One Block: This program uses the following registers.
www.DataSheet4U.com
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
;
#BLKSTR is top address of block to be erased
#BLKEND is last address of block to be erased
;
MOV.L
MOV.L
;
Execute prewrite
PREWRT: MOV.W
MOV.W
MOV.B
LOOPR0: DEC.W
BPL
SET EBR1 or EBR2 bit of block to be erased
;
MOV.B
MOV.B
PREWRN: SUB.B
MOV.W
PREWRS: MOV.B
MOV.B
MOV.W
MOV.W
MOV.W
MOV.W
MOV.B
LOOPR1: DEC.W
BPL
MOV.B
MOV.W
MOV.W
MOV.W
FFFF40
FFFF42
FFFF43
FFFFA8
#BLKSTR:32, ER1
#BLKEND:32, ER2
#g,
R4
#4140,
R6
R6L,
@FLMCR:8 ;
#1,
R4
LOOPR0
#**,
R5H
R5H,
@EBR*
R0H,
R0H
#a,
E4
#00,
R5H
R5H,
@ER1
#A579,
R5
R5,
@TCSR:16 ;
E4,
R4
#4140,
R6
R6H,
@FLMCR:8 ;
#1,
R4
LOOPR1
R6L,
@FLMCR:8 ;
#A500,
R5
R5,
@TCSR:16 ;
#c ,
R5
597
;
ER1: top address of block to be erased
;
ER2: last address of block to be erased
Set wait counter
;
;
Set V
E bit
PP
;
;
;
;
Set EBR*
;
R0: prewrite-verify fail count
;
Set initial prewrite loop counter value
Write #00 data
;
;
Start watchdog timer
;
;
Set prewrite loop counter
;
Set P bit
Prewrite
;
;
Clear P bit
Stop watchdog timer
;
Set prewrite-verify loop counter
;

Advertisement

Table of Contents
loading

Table of Contents