Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...Sandeep Swamy
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...AyanHossain
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptxRahul Jawarkar
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo SlidesCeline George
Basics and rules of probability with real-life usesravatkaran694
Interrupt in 8051 microcontrollers .pptx
1. INTERRUPTS IN 8051
• Interrupts are an important feature of a microcontroller, which enables the
microcontroller to respond to external events and requests, which enhances
the multitasking abilities of the microcontroller.
• An interrupt is an external or internal event/command that interrupts the
normal processing of an event and informs the microcontroller that a device
needs its service. Whenever a device needs its service, it sends an interrupt
signal to the microcontroller to send a notification.
• Upon receiving the interrupt signal, the microcontroller stops its existing
program and serves the external device request.
• The program associated with the interrupt is called Interrupt Service
Routine (IRS) or Interrupt handler.
2. The 8051 features two main types of interrupts,
Hardware Interrupts and Software Interrupts.
The hardware interrupts are triggered by external signals such as peripheral
events or external devices. The microcontroller can be configured to respond to
specific events, allowing for efficient event-driven programming.
Software interrupts are initiated by specific instructions in the program code.
They provide a mechanism for the programmer to force the microcontroller to
interrupt its normal execution and execute a predefined routine.
The microcontroller automatically maintains its state on interrupt, fetches
the interrupt vector's ISR address, and executes the ISR's operation.
Once the ISR is finished, the microcontroller restarts the task which has
been interrupted.
3. Interrupt structure of 8051 Microcontroller
All of the interrupts are disabled by "RESET"; thus, software is required to enable
all of these interrupts.
The relevant interrupt flags are set if any of these five interrupts or all five are
activated. The priority, which is managed by the IP interrupt priority register,
determines which of these interrupts can be set or cleared bit by bit in a specific
function register that is Interrupt Enabled (IE).
Two SFRs control the function of interrupts in 8051 microcontrollers. IE is
responsible for disabling/enabling the function, and IP is responsible for
priority assignment. The priority list offers three levels of interrupt priority:
Reset: When a reset request arrives, everything is stopped, and the
microcontroller restarts. Reset can be used to disable the interrupt priority 1.
Interrupt priority 0 can be disabled by both Reset and interrupt.
Some of the registers used in this microcontroller are :
•IE (Interrupt Enable) Register
•IP (Interrupt Priority) Register
•TCON (Timer Control) Register
5. Types of 8051 Microcontroller Interrupts
8051 Microcontroller suffers five different types of interrupts that hampers
the main program execution. These five types of interrupts are:
•Timer 0 overflow interrupt- TF0
•Timer 1 overflow interrupt-TF1
•External hardware interrupt- INT0
•External hardware interrupt- INT1
•Serial communication interrupt- RI/TI
External Hardware Interrupt- (INT0 & INT1)
The 8051 microcontrollers are able to respond to external events through
its external interrupts, INT0 and INT1.
6. External Interrupt 0 (INT0)
•It is connected to the 8051's pin PORT3.2.
•An interrupt request is issued when this pin transitions
from low to high in response to an external signal.
•It is possible to program the microcontroller to carry out a
particular Interrupt Service Routine (ISR) in response to
this interrupt.
•Set the IE (Interrupt Enable) bit for INT0 in the TCON
register and configure the IT0 (Interrupt Type 0) bit in the
TCON register corresponding to the desired triggering
condition (edge or level-triggered) in order to enable and
configure INT0.
7. External Interrupt 1 (INT1)
•It is connected to the 8051's pin PORT3.3
•When that particular pin encounters a low-to-
high transitions, INT1, like INT0, creates an
interrupt request.
•By configuring the IT1 (Interrupt Type 1) bit in
the TCON register and setting the IE bit for INT1
in the TCON register, one can enable and
configure INT1.
•A specific ISR can be executed by the
8. Timer Interrupts (Timer0 and Timer1)
Timer 0 and Timer 1 are hardware timers with
internal timer interrupts featured in the
8051 microcontrollers.
In microcontroller applications, these timers are
used to measure time intervals and generate precise
delays.
The interrupt system of the microcontroller enables
it to react quickly to outside events. Interrupts for
Timer 0 and Timer 1 are produced when their
respective timers exceed their limit.
The microcontroller will run the interrupt service
9. Timer0 Interrupt
•Since Timer 0 is an 8-bit timer, its count range is 0 to 255.
•There are two modes of operation for it, 13-bit and 16-bit. It employs the TH0
(Timer 0 High) and TL0 (Timer 0 Low) registers in 13-bit mode and only the TH0
register in 16-bit mode.
•It is possible to set timer 0 to interrupt when it approaches zero instead of
staying at its maximum value. The microcontroller can perform a particular
interrupt service routine (ISR) in response to the interrupt request that this
overflow generates.
Timer1 Interrupt
•Timer 1 is a 16-bit timer with a counting range of 0 to 65,535.
•It can operate in 16- or 8-bit mode. It employs the TL1 (Timer 1 Low) and TH1
(Timer 1 High) registers in 8-bit mode and only the TH1 register in 16-bit mode.
•Timer 1 can be set up to produce an interrupt when it overflows, just like
10. Serial Communication Interrupts (UART)
UART (Universal Asynchronous Receiver/Transmitter) is a serial
communication protocol used with 8051 microcontrollers. Data is sent over a
single cable, bit by bit, in serial transmission. In this sense, "interrupts" refers
to the processes that enable the microcontroller to react quickly to external
events.
Addressing UART communication with the 8051's interrupts:
•Initialization of UART- Set the data format, baud rate, and enable the UART
module by configuring the UART registers.
•Interrupt Enable- Depending on the operation you wish to interrupt for,
enable the UART's transmit interrupt (TI) or receive interrupt (RI).
•ISR (interrupt service routine)- To handle the interrupt, write an ISR. The ISR
in UART communication normally verifies whether the transmit buffer is
ready (TI) or whether data has been received (RI).
•Clearing the Flag- To recognize the interrupt and get ready for the next one,
11. Interrupt Vector Table
The addresses of different interrupt service routines (ISRs) are
stored in a table called the Interrupt Vector Table (IVT) in an 8051
microcontroller. It is a vital aspect of the interrupt handling
mechanism in the microcontroller.
Every interrupt has a specific place in the IVT, and the addresses
kept there point to the program memory's associated ISR's start.
By guiding the program flow to the proper place, the IVT enables
the microcontroller to respond to external events like hardware
interrupts or external signals quickly and effectively.