lecture_note6

lecture_note6 - CpE 390 Microprocessor Systems Lecture 6...

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

View Full Document Right Arrow Icon
Stevens Institute of Technology 1 CpE 390 Microprocessor Systems Lecture 6 Interrupts, Resets, and Operation Modes
Background image of page 1

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

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 2 Fundamental Concepts of Interrupts What is an interrupt? A special event that requires the CPU to stop normal program execution and perform some service related to the event. Examples of interrupts include I/O completion, timer time-out, illegal opcodes, arithmetic overflow, divide-by-0, and so on. Functions of Interrupts - Coordinating I/O activities and preventing CPU from being tied up - Providing a graceful way to exit from errors - Reminding the CPU to perform routine tasks ( ex: timer, multi-task OS, etc.) Interrupt Maskability - Interrupts that can be ignored by the CPU are called maskable interrupts . A maskable interrupt must be enabled before it can interrupt the CPU. An interrupt is enabled by setting an enable flag. - Interrupts that can’t be ignored by the CPU are called nonmaskable interrupts . - Two-level interrupt enabling capability: global interrupt mask and local interrupt mask
Background image of page 2
Stevens Institute of Technology 3 Interrupt priority The order in which the CPU will service interrupts when all of them occur at the same time. Interrupt Service The CPU provides service to an interrupt by executing a program called the interrupt service routine . A complete interrupt service cycle includes: 1. Saving the program counter value in the stack 2. Saving the CPU status (including the CPU status register and some other registers) in the stack 3. Identifying the cause of interrupt 4. Resolving the starting address of the corresponding interrupt service routine 5. Executing the interrupt service routine 6. Restoring the CPU status and the program counter from the stack 7. Restarting the interrupted program
Background image of page 3

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

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 4 When does CPU start to service an interrupt? For hardware-maskable interrupts, CPU waits till it completes the current instruction • For nonmarkable interrupts, CPU may start the service without completing the current instruction • For some SW interrupts which are caused by an error in an instruction execution, CPU starts the service without completing the current instruction.
Background image of page 4
Stevens Institute of Technology 5 Interrupt Vector Starting address of the interrupt service routine Interrupt Vector Table A table where all interrupt vectors are stored. Methods of Determining Interrupt Vectors 1. Predefined locations for starting address of service routines (8051 approach) 2. Fetching the vector from a predefined memory location for IVT (68HC12) 3. Executing an interrupt acknowledge cycle to fetch a vector number in order to locate the interrupt vector (68000 and x86 families)
Background image of page 5

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

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 6 Steps of Interrupt Programming Step 1. Initializing the interrupt vector table ORG $800 FDB service_1 ; starting address of interrupt service routine 1 FDB service_2 Step 2. Writing the interrupt service routine Step 3. Enabling the interrupt The Overhead of Interrupts - Saving and restoring of CPU status and other registers. (68HC12 needs to save
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

lecture_note6 - CpE 390 Microprocessor Systems Lecture 6...

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

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