Chapter 5
Interrupt
5.1 Interrupts
Interrupts save the current CPU status and registers, execute an interrupt service routine
(ISR), and then restore the CPU status so that processing resumes where it left off before
the interrupt. Other than the software interrupt (SWI), which is a program instruction,
interrupts are caused by hardware events such as an edge on the IRQ pin or a timer-
overflow event. The debug module can also generate an SWI under certain
circumstances.
If an event occurs in an enabled interrupt source, an associated read-only status flag will
be set. The CPU will not respond unless only the local interrupt enable is a logic 1. The I
bit in the CCR is 0 to allow interrupts. The global interrupt mask (I bit) in the CCR is
initially set after reset that masks (prevents) all maskable interrupt sources. The user
program initializes the stack pointer and performs other system setups before clearing the
I bit to allow the CPU to respond to interrupts.
When the CPU receives a qualified interrupt request, it completes the current instruction
before responding to the interrupt. The interrupt sequence obeys the same cycle-by-cycle
sequence as the SWI instruction and consists of:
• Saving the CPU registers on the stack.
• Setting the I bit in the CCR to mask further interrupts.
• Fetching the interrupt vector for the highest-priority interrupt that is currently
pending.
• Filling the instruction queue with the first three bytes of program information starting
from the address fetched from the interrupt vector locations.
While the CPU is responding to the interrupt, the I bit is automatically set to prevent
another interrupt from interrupting the ISR itself, which is called nesting of interrupts.
Normally, the I bit is restored to 0 when the CCR is restored from the value stacked on
MC9S08PA4 Reference Manual, Rev. 5, 08/2017
NXP Semiconductors
97
Summary of Contents for MC9S08PA4
Page 1: ...MC9S08PA4 Reference Manual Supports MC9S08PA4 Document Number MC9S08PA4RM Rev 5 08 2017 ...
Page 2: ...MC9S08PA4 Reference Manual Rev 5 08 2017 2 NXP Semiconductors ...
Page 22: ...MC9S08PA4 Reference Manual Rev 5 08 2017 22 NXP Semiconductors ...
Page 28: ...System clock distribution MC9S08PA4 Reference Manual Rev 5 08 2017 28 NXP Semiconductors ...
Page 150: ...Port data registers MC9S08PA4 Reference Manual Rev 5 08 2017 150 NXP Semiconductors ...
Page 196: ...Human machine interfaces HMI MC9S08PA4 Reference Manual Rev 5 08 2017 196 NXP Semiconductors ...
Page 224: ...Instruction Set Summary MC9S08PA4 Reference Manual Rev 5 08 2017 224 NXP Semiconductors ...
Page 232: ...Functional Description MC9S08PA4 Reference Manual Rev 5 08 2017 232 NXP Semiconductors ...
Page 258: ...FTM Interrupts MC9S08PA4 Reference Manual Rev 5 08 2017 258 NXP Semiconductors ...
Page 294: ...Functional description MC9S08PA4 Reference Manual Rev 5 08 2017 294 NXP Semiconductors ...
Page 398: ...Resets MC9S08PA4 Reference Manual Rev 5 08 2017 398 NXP Semiconductors ...
Page 400: ...MC9S08PA4 Reference Manual Rev 5 08 2017 400 NXP Semiconductors ...