Datasheet

78K0/Ix2 CHAPTER 25 FLASH MEMORY
R01UH0010EJ0500 Rev.5.00 664
Feb 28, 2012
25.8 Flash Memory Programming by Self-Programming
The 78K0/Ix2 microcontrollers support a self-programming function that can be used to rewrite the flash memory via a
user program. Because this function allows a user application to rewrite the flash memory by using the 78K0/Ix2
microcontroller self-programming library, it can be used to upgrade the program in the field.
If an interrupt occurs during self-programming, self-programming can be temporarily stopped and interrupt servicing
can be executed. If an unmasked interrupt request is generated in the EI state, the request branches directly from the
self-programming library to the interrupt routine. After the self-programming mode is later restored, self-programming can
be resumed. However, the interrupt response time is different from that of the normal operation mode.
Cautions 1. To prohibit an interrupt during self-programming, in the same way as in the normal operation
mode, execute the self-programming library in the state where the IE flag is cleared (0) by the DI
instruction. To enable an interrupt, clear (0) the interrupt mask flag to accept in the state where
the IE flag is set (1) by the EI instruction, and then execute the self-programming library.
2. Make sure that the regulator output voltage mode is fixed when executing self programming or
EEPROM emulation.
3. Program area can be rewritten by using the self programming library in normal power mode.
4. Observe the following points when rewriting the flash memory in low power consumption mode:
• Data area can be rewritten in low power consumption mode, but program area cannot.
Data area: Flash memory area handled as data
Program area: Flash memory area handled as the program
• Flash memory that is erased and written in low power consumption mode cannot be accessed
in normal power mode. To use this data in normal power mode, switch to low power
consumption mode and transfer the flash memory contents to RAM.
• Blocks cannot be overwritten by using the self programming library. Be sure to erase a block
first before rewriting data to it.
• A wait time of 2 ms is required before executing self programming after switching from normal
power mode to low power consumption mode.
Remark For details of the self-programming function and the self programming library, refer to “78K0
Microcontrollers User’s Manual Self Programming Library Type 01 (U18274E)” and “78K0
Microcontrollers Self Programming Library Type 01 Ver. 3.10 Operating Precautions (notification
document) (ZUD-CD-09-0122-E)”.
For details of the EEPROM emulation library, refer to “78K0 Microcontrollers User’s Manual EEPROM
Emulation Library Type 01 (U18275E)” and “78K0 Microcontrollers EEPROM Emulation Library Type
01 Ver.2.10 Operating Precautions (notification document) (ZUD-CD-09-0165-E)”.