8051 Interrupts
8051 Interrupts
An interrupt is an external or internal event that interrupts the microcontroller to inform it that
adeviceneedsits service
• Interrupt
• Polling
1. Interrupts
Whenever any device needs its service, the device notifies the microcontroller by sending
an interrupt signal.
The program which is associated with the interrupt is called the interrupt service routine
(ISR) or interrupt handler.
2. Polling
After that, it moves onto monitor the next device until everyone is serviced.
The polling method is not efficient, since it wastes much of the microcontroller’s time by polling
devices that do not need service. The advantage of interrupts is that the microcontroller can serve
many devices (not all at the same time).
Each device can get the attention of the microcontroller based on the assigned priority. For the
polling method, it is not possible to assign priority since it checks all devices in a round-robin
fashion. The microcontroller can also ignore (mask) a device request for service in Interrupt.
SixInterruptsin 8051
Sixinterruptsareallocatedasfollows:
1. Reset–power-upreset.
– P3.2 and P3.3 are for the external hardware interrupts. INT0 (orEX1), and
INT1 (orEX2).
4. Serial communication has a single interrupt belongs to both receive and transfer.
5. We can configure the 8051 so that any of the following events will cause an interrupt:
a. Timer 0 Overflow.
b. Timer 1 Overflow.
c. Reception/Transmission of Serial Character.
d. External Event 0.
e. External Event 1.
8051 Interrupt related Registers
• When the 8051 is powered up, the priorities are assigned according to the following.
• In reality, the priority scheme is nothing but an internal polling sequence in which the 8051
polls the interrupts in the sequence listed and responds accordingly.
• We can alter the sequence of interrupt priority by assigning a higher priority to anyone
of the interrupts by programming a register called IP (interrupt priority).
• To give a higher priority to any of the interrupts, we make the corresponding bit in the IP
register high.