
III PERIPHERAL MODULES 1 (SYSTEM): INTERRUPT CONTROLLER (ITC)
III-2-4
EPSON
S1C33E07 TECHNICAL MANUAL
III.2.1.2 Causes of Interrupt and Intelligent DMA
Several causes of interrupt can be set so that they can invoke IDMA startup. When one of these causes of interrupt
occurs, IDMA is started up before an interrupt request to the CPU. The interrupt request to the CPU is generated
after IDMA is completed. (The interrupt request can be disabled by a program.)
IDMA is always started up regardless of how the PSR is set. For details, refer to Section III.2.5, “IDMA
Invocation.”
III.2.1.3 Nonmaskable Interrupt (NMI)
The nonmaskable interrupt (NMI) can be generated by controlling the #NMI pin or using the internal watchdog
timer. The vector number of NMI is 7, with the vector address set to the trap table's starting address + 28 bytes.
This interrupt is prioritized over other interrupts and is unconditionally accepted by the CPU.
However, since this interrupt may operate erratically if it occurs before the stack pointer (SP) is set up, it is masked
in hardware until a write to the SP is completed after an initial reset.
For controlling the #NMI input, refer to Section III.1.3, “NMI Input.”
III.2.1.4 Interrupt Processing by the CPU
The CPU keeps sampling interrupt requests every cycle. When the CPU accepts an interrupt request, it enters trap
processing after completing execution of the instruction that was being executed.
The following lists the contents executed in trap processing.
(1) The PSR and the current program counter (PC) value are saved to the stack.
(2) The IE bit of the PSR is reset to 0 (following maskable interrupts are disabled).
(3) The IL of the PSR is set to the priority level of the accepted interrupt (NMI does not have its interrupt level
changed).
(4) The vector of the generated cause of interrupt is loaded into the PC, thus executing the interrupt processing
routine.
Thus, once an interrupt is accepted, all maskable interrupts that may follow are disabled in (2). Multiple interrupts
can also be handled by setting the IE bit to 1 in the interrupt processing routine. In this case, since the IL has been
changed in (3), only an interrupt that has a higher priority than that of the currently processed interrupt is accepted.
When the interrupt processing routine is terminated by the reti instruction, the PSR is restored to its previous status
before the interrupt has occurred. The program restarts processing after branching to the instruction next to the one
that was being executed when the interrupt occurred.
III.2.1.5 Clearing Standby Mode by Interrupts
The standby modes (HALT and SLEEP) are cleared by an NMI or a maskable interrupt.
All maskable interrupts can be used to clear HALT mode.
In SLEEP mode, since the clock supply to the peripheral circuit is disabled, interrupts from the peripheral circuits
except RTC and I/O ports cannot be used.
Interrupts that can be used to clear basic HALT mode: NMI and all maskable interrupts
Interrupts that can be used to clear SLEEP mode:
NMI, I/O port interrupts, and RTC interrupt
When the CPU is released from HALT mode by an interrupt, it enters a program executable state by trap processing
and executes an interrupt handling routine for the interrupt generated. In trap processing of the CPU, the address for
the instruction next to halt is saved to the stack as a return address from the interrupt handling routine, so that the
reti instruction in the interrupt handling routine branches to the instruction next to halt.
The CPU is released from HALT mode when the ITC asserts the interrupt signal to be sent to the CPU. In other
words, when a cause-of-interrupt flag of the interrupts that have been enabled by the interrupt enable bits in the ITC
is set to 1, the CPU can be released from HALT mode even if the PSR is set to disable interrupts. However, in this
case the CPU does not execute the interrupt handling routine.
The #NMI signal releases the CPU from HALT mode when it goes low level.