![](http://datasheet.mmic.net.cn/380000/-PD78196Y_datasheet_16744919/-PD78196Y_82.png)
CHAPTER 5 EEPROM
82
5.5 EEPROM Writing
Data writing to EEPROM is performed according to the following procedure.
<1>
Set the write time with EWCS00 to EWCS02 (EEPROM write control register 0 (EEWC0) bits 4 to 6).
<2>
Set ERE0 (EEWC0 bit 2) to 1.
<3>
Check that ERST0 (EEWC0 bit 3) is 1 (EEPROM operation enabled).
<4>
Check that EWST0 (EEWC0 bit 1) is 0 (EEPROM writing is not in progress).
<5>
Set EWE0 (EEWC0 bit 0) to 1.
<6>
Execute the write instruction.
Note
Note
An attempt to set EWE0 to 1 together with ERE0 fails. Set EWE0 with a 1-bit memory manipulation
instruction after confirming that ERST0 has been set to 1.
When performing several write operations in succession, perform the next write operation after the current write
operation has been completed. A value of at least 3.3 ms is necessary to perform one write operation. The
following methods can be used for write termination and time control.
(1)
Method using write termination interrupt request (INTEE0)
After writing one item of data, wait for the generation of a write termination interrupt request while
processing other than a write is performed. When a write termination interrupt request is generated, start
the next write operation.
(2)
Method using write status flag (EWST0)
Poll EWST0 (EEPROM write control register 0 (EEWC0) bit 1), and wait for EWST0 to become 0. When
EWST0 becomes 0, start the next write operation.
5.6 EEPROM Control-Related Interrupt
EEPROM write termination interrupt request (INTEE0) is generated from EEPROM.
INTEE0 is an interrupt request generated upon the termination of EEPROM writing.
This interrupt request is generated once the time set with EWCS00 to EWCS02 (EEPROM write control register 0
(EEWC0) bits 4 to 6) has elapsed.
When this interrupt request is generated, data writing to EEPROM is terminated, indicating that writing of the next
data is enabled.