0% found this document useful (0 votes)
11 views12 pages

Interrupt 8051

The document discusses interrupts in the 8051 microcontroller, highlighting their role in enhancing multitasking by allowing the microcontroller to respond to external and internal events. It details two main types of interrupts: hardware interrupts, triggered by external signals, and software interrupts, initiated by specific program instructions. Additionally, it outlines the various types of interrupts available in the 8051, including timer interrupts and external hardware interrupts, and explains the interrupt handling mechanism through the Interrupt Vector Table.

Uploaded by

neethuj.aaps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views12 pages

Interrupt 8051

The document discusses interrupts in the 8051 microcontroller, highlighting their role in enhancing multitasking by allowing the microcontroller to respond to external and internal events. It details two main types of interrupts: hardware interrupts, triggered by external signals, and software interrupts, initiated by specific program instructions. Additionally, it outlines the various types of interrupts available in the 8051, including timer interrupts and external hardware interrupts, and explains the interrupt handling mechanism through the Interrupt Vector Table.

Uploaded by

neethuj.aaps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

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.
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
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

Interrupt Handle flowchart
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.
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-
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
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.
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.
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).
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

You might also like