Interrupt in the microprocessor allows peripheral devices to access the microprocessor. In this post, we will study the concepts of Interrupt in microprocessor, Interrupt processing, returning to the main program after completing ISR, Interrupt process in 8085 microprocessor, and Interrupt process in 8086 microprocessor.
Interrupt in Microprocessor | Interrupt Processing
When the microprocessor receives an interrupt signal from peripheral(s) which are requesting its services, it stops its current execution, and program control is transferred to a sub-routine ( Interrupt Service Routine). This transfer is done by generating a CALL signal. And after executing the sub-routine, again program control is transferred [by generating RET signal] to the main program.
When an interrupt line goes high, the processor completes the execution of its current instruction and saves the program counter value on the stack. It also resets Interrupt Enable flip-flop (part of microprocessor architecture) before taking up ISR (Interrupt Service Routine) so that the occurrence of further interrupts by other devices is prevented during the execution of ISR. After the execution of ISR, the control returns back to the main program where it was interrupted.
How does the microprocessor return to the main program after completing the ISR of an interrupt?
In the microprocessor, the following tasks are performed if an interrupt has been requested:
- The value of the flag register is pushed into the stack. It means that first the value of SP (Stack Pointer) is decremented by 2. Then the value of the flag register is pushed to the memory address of the stack pointed by the stack pointer register.
- Save the value of program counter (PC) contents (address of the next instruction) in the stack.
- Load PC with the starting address of an ISR (Interrupt Service Routine).
- Executes the service routine program.
- Finish ISR when the return instruction (last line instruction of an ISR) is executed.
- Note: Before going to the main program, the microprocessor must set the Interrupt Enable flip-flop so that the occurrence of further interrupts by other devices is recognized by the processor.
- Return to the point in the interrupted program where an execution was interrupted.
Interrupt process in 8085 microprocessor
The following flow diagram shows the processing of an interrupt by the 8085 microprocessor.
Interrupt process in 8086 microprocessor
The following flow diagram shows the processing of an interrupt by the 8086 microprocessor
Author of this post
This post is co-authored by Professor Saraswati Saha, who is an assistant professor at RCCIIT, a renowned degree engineering college in India. Professor Saha teaches subjects related to digital electronics & microprocessors.