KS57C2308/P2308/C2316/P2316 INTERRUPTS
7-7
INTERRUPT PRIORITY REGISTER (IPR)
The 4-bit interrupt priority register (IPR) is used to control multi-level interrupt handling. Its reset value is logic
zero. Before the IPR can be modified by 4-bit write instructions, all interrupts must first be disabled by a DI
instruction.
FB2H IME IPR.2 IPR.1 IPR.0
By manipulating the IPR settings, you can choose to process all interrupt requests with the same priority level, or
you can select one type of interrupt for high-priority processing. A low-priority interrupt can itself be interrupted by
a high-priority interrupt, but not by another low-priority interrupt. A high-priority interrupt cannot be interrupted by
any other interrupt source.
Table 7-3. Standard Interrupt Priorities
The MSB of the IPR, the interrupt master enable flag (IME), enables and disables all interrupt processing. Even if
an interrupt request flag and its corresponding enable flag are set, a service routine cannot be executed until the
IME flag is set to logic one. The IME flag (mapped FB2H.3) can be directly manipulated by EI and DI instructions,
regardless of the current enable memory bank (EMB) value.
Table 7-4. Interrupt Priority Register Settings
NOTE:During normal interrupt processing, interrupts are processed in the order in which they occur. If two or more
interrupt requests are received simultaneously, the priority level is determined according to the standard interrupt
priorities in Table 7-3 (the default priority assigned by hardware when the lower three IPR bits = "0"). In this case,
the higher-priority interrupt request is serviced and the other interrupt is inhibited. Then, when the high-priority
interrupt is returned from its service routine by an IRET instruction, the inhibited service routine is started.
Interrupt Default Priority
INTB, INT4 1
INT0 2
INT1 3
INTS 4
INTT0 5
IPR.2 IPR.1 IPR.0 Result of IPR Bit Setting
000Normal interrupt handling according to default priority settings
001Process INTB and INT4 interrupts at highest priority
010Process INT0 interrupts at highest priority
011Process INT1 interrupts at highest priority
100Process INTS interrupts at highest priority
101Process INTT0 interrupts at highest priority