
CHAPTER 16 FLASH MEMORY
User’s Manual U12768EJ4V1UD
417
16.7.5 Software environment
The following conditions must be satisfied before using the entry program to call the device internal processing.
Table 16-9. Software Environmental Conditions
Item
Description
Location of entry
program
Execute the entry program in memory other than the flash memory area.
The device internal processing cannot be directly called by the program that is executed on the flash
memory.
Execution status of
program
The device internal processing cannot be called while an interrupt is being serviced (NP bit of PSW =
0, ID bit of PSW = 1).
Masking interrupts
Mask all the maskable interrupts used. Mask each interrupt by using the corresponding interrupt
control register.
Mask the maskable interrupts even when the ID bit of the PSW = 1 (interrupts are disabled).
Manipulation of VPP
voltage
Stabilize the voltage applied to the VPP pin (VPP voltage) before starting manipulation of the flash
memory. After completion of manipulation, return the voltage of the VPP pin to 0 V.
Initialization of internal
timer
Do not use 16-bit timer 0 while the flash memory is being manipulated.
Because 16-bit timer 0 is initialized after the flash memory has been used, initialize the timer with the
application program to use the timer again.
Stopping reset signal
input
Do not input the reset signal while the flash memory is being manipulated.
If the reset signal is input while the flash memory is being manipulated, the contents of the flash
memory under manipulation become undefined.
Stopping NMI signal
input
Do not input the NMI signal while the flash memory is being manipulated.
If the NMI signal is input while the flash memory is being manipulated, the flash memory may not be
correctly manipulated by the device internal processing.
If an NMI occurs while the device internal processing is in progress, the occurrence of the NMI is
reflected in the NMI flag of the RAM parameter. If manipulation of the flash memory is affected by the
occurrence of the NMI, the function of each self-programming function is reflected in the return value.
Reserving stack area
The device internal processing takes over the stack used by the user program. It is necessary that an
area of 300 bytes be reserved for the stack size of the user program when the device internal
processing is called. r3 is used as the stack pointer.
Saving general-purpose
registers
The device internal processing rewrites the contents of r6 to r14, r20, and r31 (lp).
Save and restore these register contents as necessary.