written 7.8 years ago by |
Interrupt in 8051 microcontroller are more desirable to reduce the regular status checking of the interface device.
Interrupt is an event that temporarily suspends the main program passes the control to a special code section, execute the event related function and resumes the main program how where it had left off.
Interrupt service routine (ISR) comes into the picture when interrupt occur and then tells the processor to take appropriate action for the interrupt and after ISR execution the controller jumps into the main program.
In 8051, five type of interrupt
- Timer 0 overflow interrupt -> TF0
- Timer 1 overflow interrupt -> TF1
- External hardware interrupt -> INT0
- External hardware interrupt -> INT1
- Serial communication interrupt -> RI/TI
RESET all the interrupt get disable and therefore all these interrupt must be enabled by a software. In all these five interrupt, if anyone or all are activated this sets the corresponding interrupts flag.
All these interrupts can be set or cleared by bit in special function register that is interrupt enabled (IE) and this in turn depends on the priority which is executed by IP interrupt priority register.