Prewrite Flowchart
Figure 18-17 Prewrite Flowchart
End of prewrite
n
≥
N?
n + 1
Double
the programming
time (x
×
2
→
x)
→
n
No
Start
Address = top address
Wait initial value setting x = 15
µ
s
Write H'00 to flash memory
(flash memory latches
write address and write data)
Enable watchdog timer
*
2
*
1
Select program mode
(set P bit to 1 in FLMCR)
Wait (x)
µ
s
Clear P bit
Disable watchdog timer
Wait (t
VS1
)
µ
s
Prewrite verify
*
3
(read data = H'00?)
Last address?
No good
No
Yes
Programming ends
Programming error
A 1
→
address
OK
Yes
Set erase block register
(set bit of block to be erased to 1)
Wait (z)
µ
s
n = 1
V E
PP
Clear bit
Clear erase block register
(clear bit of block to be erased to 0)
V E
PP
Set bit
( bit = 1 in FLMCR)
V E
PP
Clear erase block register
(clear bit of block to be erased to 0)
Clear V
PP
E bit
Notes: 1. Use a byte transfer instruction.
2. Set the watchdog timer overflow
interval by setting CKS2 = 0,
CKS1 = 0 and CKS0 = 0.
3. In prewrite-verify mode P, E, PV,
and EV are all cleared to 0 and
12 V is applied to V
PP
. Use a byte
transfer instruction.
4. t
VS1
: 4 µs
z:
5 to 10 µs
N:
6 (set N so that total
programming time does not
exceed 1 ms)
596
www.DataSheet4U.com