Individual Interrupt Control
7-13
Interrupts
7.3
Individual Interrupt Control
Servicing interrupts effectively requires individual control of all three types of
interrupts: reset, nonmaskable, and maskable. Enabling and disabling individ-
ual interrupts is done with the interrupt enable register (IER). The status of
pending interrupts is stored in the interrupt flag register (IFR). Manual interrupt
processing can be accomplished through the use of the interrupt set register
(ISR) and interrupt clear register (ICR). The interrupt return pointers restore
context after servicing nonmaskable and maskable interrupts.
7.3.1
Enabling and Disabling Interrupts (Interrupt Enable Register–IER)
You can enable and disable individual interrupts by setting and clearing bits
in the IER that correspond to the individual interrupts. An interrupt can trigger
interrupt processing only if the corresponding bit in the IER is set. Bit 0, corre-
sponding to reset, is not writeable and is always read as 1, so the reset inter-
rupt is always enabled. You cannot disable the reset interrupt. Bits IE4–IE15
can be written as 1 or 0, enabling or disabling the associated interrupt, respec-
tively. The IER is shown in Figure 7–6.
Figure 7–6. Interrupt Enable Register (IER)
31
16
Reserved
15
0
IE15
IE14
IE13
IE12
IE11
IE10
IE9
IE8
IE7
IE6
IE5
IE4
R, W, +0
NMIE
1
R, +1
Rsv
Rsv
Legend: R = Readable by the MVC instruction
W = Writeable by the MVC instruction
Rsv = Reserved
+1 = Value after reset
+0 = Value after reset
When NMIE = 0, all nonreset interrupts are disabled, preventing interruption
of an NMI. NMIE is cleared at reset to prevent any interruption of processor
initialization until you enable NMI. After reset, you must set NMIE to enable the
NMI and to allow INT15–INT4 to be enabled by GIE and the appropriate IER
bit. You cannot manually clear the NMIE; the bit is unaffected by a write of 0.
NMIE is also cleared by the occurrence of an NMI. If cleared, NMIE is set only
by completing a B NRP instruction or by a write of 1 to NMIE. Example 7–4 and
Example 7–5 show code for enabling and disabling individual interrupts,
respectively.