Rev. 1.0, 02/00, page 149 of 1141
Programming pulse apply subroutine
Start
Set SWE1 (2) bit in FLMCR(2)
Set PV1(2) bit in FLMCR1(2)
Clear PV1(2) bit in FLMCR1(2)
Clear SWE1(2) bit in FLMCR1(2)
Write pulse additional program pulse 10 µs
Store 128-byte program data in program
data area and reprogram data area
Write 128-byte program data in RAM reprogram
data area consecutevely to flash memory
Write 128-byte program data in RAM additional
data area consecutively to flash memory
Wait 1 µs
Wait 4 µs
Wait 2 µs
Wait 2 µs
Wait 100 µs
End of programming
Programming pulse 30 µs or 200 µs
H'FF dummy write to verify address
Read verify data
Calculate additional program data
Calculate reprogram data
Complete 128-byte
data verification?
Transfer additional program data to additional program data area
Transfer reprogram data to reprogram data area
Program data= verify data?
Refer to note
*
6
for the pulse width
*
1
*
2
*5
*
4
*
3
*
4
*
1
NG
NG
NG
NG
NG
OK
OK
OK
OK
OK
6 n?
n
←
n+1
6 n ?
m= 0?
Clear SWE1 (2) bit in FLMCR1(2)
Wait 100 µs
Programming Failure
NG
OK
n 1000?
m= 1
*
4
Call subroutine
n= 1
m= 0
Enable WDT
Set PSU1 (2) bit in FLMCR1 (2)
Set P1 (2) bit in FLMCR1 (2)
Clear P1(2) bit in FLMCR1 (2)
Clear PSU1(2) bit in FLMCR1 (2)
Wait 50 µs
Wait 5 µs
Wait 5 µs
Disable WDT
End of subroutine
Note: 6. Programming pulse width
Number of times
of programming
Programming
time (z) µsec
The programming pulse must be 10 µs in
additional programming
Perform programming after erasing data. Do not perform additional programming to addresses that have already been written to.
Notes: 1. Data transfer is performed by byte transfer. The lower eight bits of the start address must be H'00 or H'80. A 128-byte data transfer must be performed even if writing
fewer than 128 bytes: in this case, H'FF must be written to the extra addresses.
2. Verify data is read in 16-bit (word) units.
3. Even in case of the bit which is already-programmed in the 128-byte programming loop, perform additional programming if the bit fails at the next verify.
4. An area for storing program data (128 bytes), reprogram data (128 bytes), and additional program (128bytes) must be provided in RAM. The contents of the reprogram
and additional program areas are rewritten as programming processes.
5. A 30 µs or 200 µs programming pulse must be applied.
For details on programming pulse, refer to Notes*6.
To perform additional data programming, apply a programming pulse of 10 µs. Reprogram data X' is the reprogram data after program pulse is applied.
Program data storage are
(128 bytes)
Reprogram data storage
area (128 bytes)
Additional program data
storage area (128 bytes)
Reprogram Data Calculation Table
Additiona l program data calculation table
Increment address
Wait for 10 µs, 30 µs or 200 µs
1
2
3
4
5
6
7
8
9
10
11
12
13
998
999
1000
30
30
30
30
30
30
200
200
200
200
200
200
200
200
200
200
RAM
Source Data (D)
0
0
1
1
Reprogram data (X)
1
0
1
1
Additional program data (Y)
0
1
1
1
Reprogram data (X')
0
0
1
1
Comments
Verify data (V)
0
1
0
1
Verify data (V)
0
1
0
1
Programming completed
Programming incomplete; reprogram
Still in erased state; no action
Comments
Additional programming performed
Additional programming not performed
Additional programming not performed
Figure 7.12 Program/Program-Verify Flowchart