1 / 8

ECE 424 Design of Microprocessor-Based Systems

ECE 424 Design of Microprocessor-Based Systems. Interrupt Processing. Haibo Wang ECE Department Southern Illinois University Carbondale, IL 62901. Hardware and Software Interrupts.

aitana
Download Presentation

ECE 424 Design of Microprocessor-Based Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 424 Design of Microprocessor-Based Systems Interrupt Processing Haibo Wang ECE Department Southern Illinois University Carbondale, IL 62901

  2. Hardware and Software Interrupts • An interrupt is an even that causes the processor to stop its current program execution and switch to performing an interrupt service routine. • Hardware and Software Interrupts • Hardware Interrupts are caused by proper inputs at NMI or INTR input pin • Software Interrupts are caused by executing programs • Interrupt Priority • When multiple interrupts occur at the same time, the interrupt with the highest priority will be served • Interrupt Type • Interrupt type is used as the table index to search the address of interrupt service routine from the interrupt vector table

  3. Interrupt Vector Table 00000 • Interrupt vector table is used to store the addresses of interrupt service routine IP Type-0 CS • Interrupt vector table contains 256 table entries. Each table entry takes 4 bytes; two bytes are for IP values and two bytes are for CS values Type-1 • Interrupt vector table locates at the reserved memory space from 00000H to 003FFH ••••• • Example: Assume that the interrupt service routine for the type-40 interrupt is located at address 28000H. How do you write this address to the vector table? Type-255 003FFH

  4. Interrupt Processing Sequence Get Vector Number (get the interrupt type) • Caused by NMI, it is type 2 • Caused by INTR, the type number will be fed to the processor through data bus • Caused by executing INT instructions, the type number is given by the operand • ••• Save Processor Information • Push flag register into stack • Clear trace flag and interrupt-enable flag • Push CS and IP into stack Fetch New Instruction Pointer • Load new CS and IP values from the instruction vector table Execute interrupt service routine Return from interrupt service routine • Pop flag register from stack • Pop CS and IP from stack

  5. Interrupt Service Routine • An Interrupt Service Routine (ISR) is a section code that take care of processing a specific interrupt • Some ISRs also contain instructions that save and restore restore general purpose registers • Example: Interrupt Vector Table 1234:00AE PUSH AX PUSH DX MOV AX, 5 MUL BL MOV [DI], AX MOV [DI+2], DX POP DX POP AX IRET 000A4 AE 000A5 00 INT ? 000A6 34 000A7 12

  6. Storing Environment During Interrupt Processing Done automatically By the processor User Program Interrupt Service routine Save flag and return address Save register Read ISR address from interrupt vector table ISR body INT Restore register Read return address and flag IRET

  7. Special Interrupts • Divide-Error • Type-0 interrupt. It has the highest interrupt priority • Single-Step • Type-1 interrupt. It is generated after each instruction if the trace flag is set • NMI • Type-2 interrupt • Breakpoint • Type-3 interrupt. It is used for debug purposes • Overflow • Type-4 interrupt. It is generated by INTO when the overflow flag is set

  8. Schmitt trigger 8088 NMI 120V 60Hz Interrupt Example • An NMI Time Clock • Instructions for update Interrupt Vector Table MOV COUNT, 60 PUSH DS SUB AX, AX MOV DS, AX LEA AX, NMITIME MOV [8], AX MOV AX, CS MOV [0AH], AX POP DS • ISR NMITIME: DEC COUNT JNZ EXIT MOV COUNT, 60 CALL FAR PTR ONESEC EXIT: IRET

More Related