Interrupts of 8051 Microcontroller

Interrupts are mechanisms that allow the microcontroller to pause its current execution and jump to a specific subroutine to handle an event, improving real-time control and multitasking capabilities.
The 8051 microcontroller is a widely used microcontroller architecture that features several interrupt sources to handle various events and enhance its responsiveness.

Here are the different interrupts of 8051 microcontroller:

8051 Microcontroller Interrupts

  1. External Interrupt 0 (IE0): This interrupt is triggered by an external signal applied to the INT0 pin (P3.2). It is edge-triggered (either rising or falling edge) and can be used for various purposes, such as responding to external events like button presses or sensor outputs.
  2. Timer 0 Interrupt (TF0): The Timer 0 interrupt is generated when the Timer 0 register overflows. Timer 0 can be set in various modes and is often used for generating precise time delays and generating periodic events.
  3. External Interrupt 1 (IE1): Similar to External Interrupt 0, this interrupt is triggered by an external signal applied to the INT1 pin (P3.3). It also operates in an edge-triggered manner.
  4. Timer 1 Interrupt (TF1): The Timer 1 interrupt is generated when the Timer 1 register overflows. Timer 1 has a more advanced feature set than Timer 0 and is often used for more complex timing operations.
  5. Serial Communication Interrupt (RI/TI): The 8051 has a built-in UART (Universal Asynchronous Receiver-Transmitter) for serial communication. The Receive Interrupt (RI) is triggered when data is received, while the Transmit Interrupt (TI) is triggered when the UART is ready to transmit data.

Interrupt structure of 8051 Microcontroller

There are five interrupt sources for the 8051, which means that they can recognize 5 different events that can interrupt regular program execution. Each interrupt can be enabled or disabled by setting bits of the IE register.

Likewise, the whole interrupt system can be disabled by clearing the EA bit of the same register. Following figure shows the interrupt structure of 8051 microcontroller.

Interrupt structure of 8051 Microcontroller, Interrupts of 8051 Microcontroller
Figure: Interrupt structure of 8051 Microcontroller

Each of these interrupts has a corresponding interrupt flag bit in the Interrupt Enable (IE) register. These flags can be set or cleared by the hardware or software to enable or disable the respective interrupts.

When an interrupt is enabled and its corresponding flag is set, the microcontroller stops its current execution and jumps to the respective interrupt service routine (ISR) to handle the event. After servicing the interrupt, the microcontroller returns to its regular execution flow.

IE Register (Interrupt Enable)

format for IE interrupt enable register in 8051 microcontroller
Figure: Format of Interrupt Enable register in 8051 microcontroller

EA – global interrupt enable/disable:

  • 0 – disables all interrupt requests.
  • 1 – enables all individual interrupt requests.

ES – enables or disables serial interrupt:

  • 0 – UART system cannot generate an interrupt.
  • 1 – UART system enables an interrupt.

ET1 – bit enables or disables Timer 1 interrupt:

  • 0 – Timer 1 cannot generate an interrupt.
  • 1 – Timer 1 enables an interrupt.

EX1 – bit enables or disables external 1 interrupt:

  • 0 – change of the pin INT0 logic state cannot generate an interrupt.
  • 1 – enables an external interrupt on the pin INT0 state change.

ET0 – bit enables or disables timer 0 interrupt:

  • 0 – Timer 0 cannot generate an interrupt.
  • 1 – enables timer 0 interrupt.

EX0 – bit enables or disables external 0 interrupt:

  • 0 – change of the INT1 pin logic state cannot generate an interrupt.
  • 1 – enables an external interrupt on the pin INT1 state change.

Recent posts

1 thought on “Interrupts of 8051 Microcontroller”

Leave a Comment

Your email address will not be published. Required fields are marked *