RL78/F13, F14 CHAPTER 27 SAFETY FUNCTIONS
R01UH0368EJ0210 Rev.2.10 1596
Dec 10, 2015
27.3.4 CPU stack pointer monitor function
The CPU stack pointer monitor is used to detect overflows and underflows of the stack pointer and to generate interrupts
in response.
Caution The CPU stack pointer monitor function is disabled during on-chip debugging.
<Configuration>
This function has the following functions.
SP overflow/underflow detection function
SP overflow/underflow interrupt output function
When the SPM enable bit (SPMEN) is 1, an interrupt signal (INTSPM) is generated if the monitored stack pointer value
is greater than the specified SFR value (SPOFR) or smaller than the specified SFR value (SPUFR).
When the SPM enable bit (SPMEN) is 1, writing to the SPOFR and SPUFR registers is invalid.
<Register setting method>
Figure 27-14 shows the register setting method of this function.
Figure 27-14. Register Setting Flow
[Standard usage]
1. Write the initial value to the SPOFR and SPUFR registers.
2. Set the SPMEN bit in the SPMCTRL register.
<Control register>
Register Name Description Access Size
SPMCTRL SPM control register 8 bits
SPOFR SP overflow address setting register 16 bits
SPUFR SP underflow address setting register 16 bits
Remarks 1. If the overflow or underflow state is retained, another overflow or underflow will not be detected. After an
overflow or underflow was detected, reset the stack pointer to a value within the range of monitoring.
2. If an overflow or underflow interrupt request is received, the value obtained by subtracting 4 from the current
value of the stack pointer is always used for saving the interrupt.
<R>