written 7.8 years ago by |
Interrupt is an external or internal event that disturb the microcontroller to inform it that a device needs its service, the program which is associated with the interrupt is called interrupt service routine (ISR) or interrupt handler.
8051 microcontroller has five interrupt:
- Timer 0 overflow interrupt
- Timer 1 overflow interrupt
- External interrupt 0 (INT 0)
- External interrupt 1 (INT 1)
- Serial port events (buffer full, buffer empty)
Each interrupt has specific place in code memory where program execution (interrupt service routine) begin
- External interrupt 0 : 00034
- Timer overflow : 000BH
- External interrupt 1 : 00BH
- Timer 1 overflow : 001BH
- Serial interrupt : 00234
These interrupts must be enabled by software in order for the microcontroller to respond to them. This is done by 8-bit register called Interrupt Enable Register (IER)
7-bit : EA : Global enable/disable, to enable the interrupt this bit must be set high
6-bit : - : Undefined reserved for future use
5-bit : ET2 : Enable/disable timer 2 overflow interrupt
4-bit : ES : Enable/disable serial port interrupt
3-bit : ET1 : Enable/disable Timer 1 overflow interrupt
2-bit : EX1 : Enable/disable external interrupt 1
1-bit : ET0 : Enable/disable timer 0 overflow interrupt
0-bit : EX0 : Enable/disable external interrupt 0