Chapter12 Interrupts

Chapter12 Interrupts - Program Interrupts Chapter 12...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Program Interrupts Chapter 12 Program interrupts An “event” interrupts a running program to force execution of another program Signal from an external device Signal from an internal device Exceptional condition (ex. divide by 0) Software interrupt instruction (swi) CPU executes an “interrupt service routine” to deal with the interrupt event Process control SW (Fig. 12-1) Typical With interrupts Asynchronous events (Fig. 12-2) Timeline: Expanded Timeline: Signals from external devices on designated CPU pins IRQ (interrupt request) pin XIRQ (non-maskable interrupt request) pin Signals from internal functions Timers Communication channels Detected failures (clock, illegal instruction,etc.) Software interrupt instruction (SWI) HCS12 interrupt sources Hardware interface for IQR* and XIRQ* ( Figure 12-5 ) Enabling/disabling interrupts Disble IRQ: ORCC #%00010000 (formerly SEI) Enable IRQ: ANDCC #%11101111 (formerly CLI) Enable XIRQ: ANDCC #%10111111 S X H I N Z V C Mask IRQ Mask XIRQ 1 “masks” (disables) IRQ/XIRQ 0 “unmasks” (enables) IRQ/XIRQ [default state] X bit cannot be set to 1 after it has been cleared. Therefore, once enabled, XIRQ cannot be disabled. Condition Code Register (CCR) CPU actions in an interrupt sequence 1. Check interrupt signals after completing current instruction 2. Determine address of interrupt service routine (interrupt vector) 3. Push PC (return address) on stack 4. Push X, Y, A, B, CCR onto stack 5. Set I bit in CCR (mask other interrupts) 6. Branch to interrupt service routine Return from interrupt Execute RTI instruction RTI pulls from stack: CCR, B, A, X, Y, PC Pulling PC from stack returns CPU to the interrupted program Restoring original CCR also restores original X and I bits (reenables interrupts) Software does not need to reenable interrupts Interrupt vectors...
View Full Document

This note was uploaded on 09/23/2011 for the course ELEC 2220 taught by Professor Staff during the Summer '08 term at Auburn University.

Page1 / 29

Chapter12 Interrupts - Program Interrupts Chapter 12...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online