MOTOROLA
5-12
RESETS AND INTERRUPTS
M68HC11
REFERENCE MANUAL
CCR.
The interrupt mask bits in the CCR provide a means of controlling the nesting of inter-
rupts. In rare cases, it may be useful to allow an interrupt routine to be interrupted
(nesting of interrupts). Nesting of interrupts is discouraged because it greatly compli-
cates a system and rarely improves system performance. By default, the interrupt
structure inhibits interrupts during the interrupt entry sequence by setting the interrupt
mask bit(s) in the CCR. As the CCR is recovered from the stack during the RTI instruc-
tion, the CCR bits return to the enabled state so additional interrupts can be serviced.
If nesting of interrupts is desired, it must be specifically allowed by clearing the inter-
rupt mask bit(s) after entering the interrupt service routine. Care must be taken to spe-
cifically mask (disable) the present interrupt with a local enable mask bit or to clear the
interrupt source flag before clearing the mask bit in the CCR; otherwise, the same
source would immediately interrupt, and an infinite loop could result.
Upon reset, both the X and I bit are set to inhibit all maskable interrupts and XIRQ.
After minimum system initialization, software may clear the X bit by a transfer accumu-
lator A to CCR (TAP) instruction, thus enabling XIRQ. Thereafter, software cannot set
the X bit; thus, an XIRQ is effectively a non-maskable interrupt. Since the operation of
the I-bit-related interrupt structure has no effect on the X bit, the external XIRQ pin re-
mains effectively non-maskable. In the interrupt priority logic, XIRQ is a higher priority
than any source that is maskable by the I bit. All I-bit-related interrupts operate normal-
ly with their own priority relationship. When an I-bit-related interrupt occurs, the I bit is
automatically set by hardware after stacking the CCR byte, but the X bit is not affected.
When an XIRQ occurs, both the X and I bits are automatically set by hardware after
stacking the CCR. An RTI instruction restores the X and I bits to their pre-interrupt re-
quest state.
5.3.1 Interrupt Recognition and Stacking Registers
An interrupt can be recognized at any time provided it is enabled by its local mask (if
any) and by the global mask bit in the CCR. Once any interrupt source is recognized,
the CPU will respond at the completion of the currently executing instruction. Instruc-
tions cannot be interrupted; rather, the CPU decides whether to fetch another instruc-
tion or process an interrupt. In calculating the latency time from the actual interrupt
request to the CPU response to that request, the user must consider the possibility that
the CPU had just started a long instruction as the interrupt was requested. Most in-
structions are two to four cycles long, but the multiply (MUL) and integer divide (IDIV)
or fractional divide (FDIV) instructions are 10 and 41 cycles, respectively.
When the CPU decides to service an interrupt, the contents of CPU registers are
pushed (stored) on the stack in the order PCL, PCH, IYL, IYH, IXL, IXH, ACCA, ACCB,
CCR. After the CCR value is stacked, the I bit in the CCR (and the X bit if XIRQ is
pending) is set to inhibit further interrupts. The interrupt sequence then proceeds to
the priority resolution step.
5.3.2 Selecting Interrupt Vectors
After the CCR has been stacked, the CPU evaluates all pending interrupt requests to