Lecture22 - 0306-250 Assembly Language Programming Lecture Twenty-Two Hardware Interrupts(Text Chapter 12 Peripheral/CPU Interaction •

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: 0306-250 Assembly Language Programming Lecture Twenty-Two: Hardware Interrupts (Text Chapter 12) Peripheral/CPU Interaction • Initialization: peripheral device configured as needed • Operating modes – Polling – Interrupt • Shutdown: peripheral device disabled 2 Device Polling Operating Mode • CPU-driven service – CPU examines device status • Periodically • Continually – CPU determines if device requires service • Delayed service time – Depends on CPU polling interval 3 Device Interrupt Operating Mode • Peripheral device-driven service – Peripheral device determines it needs service – Peripheral device then notifies CPU • Immediate service time – CPU acts on interrupt 4 Interrupt Somewhat like Subroutine • Similarities – Called to handle task – Stack used in handling • Differences – Called via signal attached to CPU – Can occur at any time 5 Hardware Interrupts • Calling mechanism: Interrupt request (IRQ) line Analog of BSR/JSR for subroutine • Called code: Interrupt service routine (ISR) Analog of subroutine for interrupt 6 Interrupt Request (IRQ) Lines • Physical wires to microprocessor • Connected to external peripheral devices • Interrupt program execution • Vary by processor – Organization – Capabilities 7 HCS12 Block Diagram MC9S12C Family Reference Manual, p. 20 8 Interrupt Service Routine (ISR) • Software associated with an interrupt • “Interrupt handler” ISR + IRQ = Device Driver 9 Interrupting Program Execution • During execution, IRQ activated • Program execution interrupted • ISR for IRQ executes • Program resumes at point of interruption – No change to instruction execution – No disruption to program data 10 Interrupt System Specifications • Recognize asynchronous external events (IRQs) – Variety of interrupting signals – Examples: Signal level, signal edge • Interrupt program at currently executing instruction • Branch to correct ISR for IRQ • Return to interrupted program where it was interrupted • Allow program to ignore or acknowledge interrupts – All interrupts (except nonmaskable interrupt [NMI]) – Selected interrupts • Deal with multiple, concurrent interrupts: IRQ priority 11 Controlling Interrupts • Device enables/disables interrupts – Enabled: IRQ generated when service needed – Masked: IRQ not generated, even if service needed • Program unmasks/masks interrupts – Unmasked: Responds to interrupt – Masked: Ignores interrupt 12 IRQ Priority Dealing with multiple interrupts • Simultaneous interrupts – Hardware prioritization – Example: Priority decoder • Nested sequential interrupts – Software and hardware prioritization – Example: By default, HCS12 ISR call masks other IRQs 13 HCS12 Hardware IRQs • 17 standard IRQs – 2 dedicated external interrupts: IRQ_L, XIRQ_L – 12 timer subsystem interrupts – 2 serial interface (SCI) block interrupts – 1 A/D converter interrupt • Hardware reset: RESET – Traditionally considered interrupt – Different: Interrupted program never resumes 14 ...
View Full Document

This note was uploaded on 05/06/2010 for the course EECC 0306-250 taught by Professor Roymelton during the Fall '10 term at RIT.

Ask a homework question - tutors are online