CHAPTER 5 EEPROM
86 User’s Manual U10676EJ3V0UM
Example Set the write time to 18 × 28/fX and after checking the EEPROM write status flag (EWST), write 8-bit
data (0AH) at 08H of memory bank 4.
SET1 MBE
SEL MB15 ; Selection of bank 15
MOV XA, #01011000B ; Write enable
MOV EWC, XA ; Set the write time to 18 × 28/fX
SKF EWST
BR A1
SEL MB4
MOV XA, #0AH
MOV 08H, XA ; Write
CLR1 MBE
WAIT; SKF EWST <A>
BR WAIT
CLR1 EWE
Caution The development tool simulates writing data to EEPROM by writing the data to RAM. Therefore,
it seems as if EEPROM was normally written even if the wait time <A> is not long enough.
However, data cannot be written correctly to the device unless the wait time <A> is long enough
(4.0 ms MIN., 10.0 ms MAX.) (the contents written to the EEPROM are undefined). After writing
the data, clear EWE to 0.
Cautions on EEPROM writing are shown below. Be sure to read them before writing to EEPROM. When performing
consecutive writing, write once after the current write operation is finished. Set EWTC4 to EWTC6 so that data can
be written to the EEPROM once within the following time.
•With
µ
PD754144 ... 18 × 28/fCC (4.6 ms: fCC = 1.0 MHz)
•With
µ
PD754244 ... 4.0 ms MIN., 10.0 ms MAX.
Clear EWE to 0 after writing.
Writing can be completed and time can be managed in the following ways.
(1) Using write end interrupt
After one data item is written, wait for generation of a write end interrupt, while performing processing other
than writing. When a write end interrupt is generated, start the next write operation.
(2) Using write status flag
Execute polling on the write status flag and wait until it becomes 0.
When the write status flag becomes 0, it indicates the write end, and so start the next write operation.
(3) Using timer
Use the timer counter or basic interval timer to waitNote for the write time set by EWTC4 to EWTC6.
(4) Using software
Use the software timer to waitNote for the write time set by EWTC4 to EWTC6.
Note Make sure that a wait time longer than the write time specified by EWTC4 to EWTC6 elapses. If EWE is
cleared within the time set by EWTC4 to EWTC6, the contents written to the EEPROM are undefined.