What is Interrupt and Types of Interrupt

In this course, we will study what is interrupt and its types - hardware and software interrupt, types of software interrupts, and ISR. So let us start.

What is an interrupt?

An interrupt is nothing but the signals generated by the external devices that interrupts the normal flow of the program. Interrupts are generally the requests from the external device to the microprocessor for performing some actions. In case when an interrupt occurs the microprocessor shifts and starts working on a temporary work on a different task, and then later return to its previous task. Interrupts can be internal or external. When the interrupt occurs, the program stops executing and the microcontroller begins to execute the ISR.

What are the interrupt sources?

  1. Hardware interrupt occurs due to the change in the state of the microprocessor.
  2. The software interrupts are triggered by the execution of a machine instruction.

What are the basic types of interrupts?

There are two basic types of interrupt. The hardware interrupt and the software interrupt.

types of interrupts

HARDWARE INTERRUPT

If the signal for the processor is from the external device or hardware is called hardware interrupts. Example: if we will press a key from the keyboard to do some action. This will generate a signal which is given to the processor to do action, we call such interrupts as hardware interrupts. There are two types of hardware interrupt.

SOFTWARE INTERRUPT

Software interrupts are the interrupts that can be inserted into a desired location in the program. Software interrupts can also be divided into two types. They are

VECTOR INTERRUPT

The interrupt address is known to the processor in this kind of interrupt.

NON-VECTOR INTERRUPT

The interrupts address is unknown to the processor, so we need to send the interrupt address externally by the device to perform interrupts.

What are the types of interrupts according to the relationship with the clock?

Synchronous Interrupt

The source of the interrupt is in phase to the system clock is called an asynchronous interrupt. Interrupts are dependent on the system clock. Example: timer service that uses the system clock.

Asynchronous Interrupts

If the interrupts are independent or not in phase to the system clock is called an asynchronous interrupt.

What are the types of software interrupts?

TRAP

It is a non-maskable interrupt. It has the highest priority among all interrupts. By default, the interrupt is enabled until it gets acknowledged. In case of failure, the interrupt executes as ISR and sends the data to backup memory.

RST7.5

It is a maskable interrupt. It has the second-highest priority among all interrupts. During the execution of this interrupt the processor saves the content of the PC register into the stack and branches to 003CH address.

RST 6.5

It is a maskable interrupt. It has the third-highest priority among all interrupts. During the execution of this interrupt the processor saves the content of the PC register into the stack and branches to the 0034H address.

RST 5.5

It is a maskable interrupt. During the execution of this interrupt, the processor saves the content of the PC register into the stack and branches to the 002CH address.

INTR

It is a maskable interrupt. It has the lowest priority among all interrupts. It can be disabled by resetting the microprocessor.
When the INTR signal goes high, the following events can occur −

What is ISR?

ISR (interrupt service routine) which is also known as an interrupt handler. In case if there is an interrupt present then it will immediately trigger the interrupt handler, the handler will stop the instruction which is being processed and its configuration will be saved in a register and will load the program counter of the interrupt from a location which is given by the interrupt vector table.

After the processing of the interrupt by the processor, the interrupt handler will load the instruction and its configuration from the saved register, the process will start its processing where it’s left. This saving the old instruction processing configuration and loading the new interrupt configuration is also called context switching.

The main features of the ISR are

  1. Interrupts can occur at any time, that is they are asynchronous. ISR’s can call for asynchronous interrupts.
  2. Interrupt service mechanisms can call the ISR’s from multiple sources.
  3. ISR’s can handle both maskable and non-maskable interrupts. An instruction in a program is able to disable or enable an interrupt handler call.
  4. At the beginning of execution, it will disable other devices' interrupt services. After completion of the ISR execution, it will reinitialize the interrupt services.
  5. In the ISR the nested interrupts are allowed for diversion.