- The external interrupts are the interrupts received from the (external) devices interfaced with the microcontroller. They are received at INTx pins of the controller. The 8051 has two external hardware interrupts PIN 12 (P3.2) and Pin 13 (P3.3) of the 8051, designated as INT0 and INT1 are used as external hardware interrupts. Upon activation of these pins, the 8051 gets interrupts in what ever it is doing and jumps to the vector table to perform the interrupt service routine.
Type of Interrupt
1)Level-Triggered Interrupt
2)Edge -Triggered Interrupt
Level-Triggered Interrupt
In this mode, INT0 and INT1 are normally high and if the low level signal is applied to them ,It triggers the Interrupt. Then the microcontroller stops and jumps to the interrupt vector table to service that interrupt .
Edge -Triggered Interrupt
Upon reset 8051 makes INT0 and INT1 low l Level-Triggered Interrupt. To make them Edge -Triggered Interrupt, we must program the bits of the TCON Register. The TCON register holds among other bits and IT0 and IT1 flags bit the determine level- or edge triggered mode Of the hardware interrupt.
- Registers used in programming of INT0 and INT1 are TCON and IE
-
TCON
- TR1=0 mean, to stop timer 1 .
- TR1=1 mean, to start timer 1.
- TR0=0 mean, to start timer 0.
- TR0=1 mean, to start timer 0.
- TF1=1 mean overflow condition occur in Timer 1.
- TF1=0 mean Timer 1 is in running condition.
- TF0=1 mean overflow condition occur in Timer 0.
- TF0=0 mean Timer 0 is in running condition.
- IT1=1 mean interrupt trigger is negative edge sensitive.
- IT1=0 mean interrupt trigger is positive edge sensitive.
- IT0=1 mean interrupt trigger is negative edge sensitive.
- IT0=0 mean interrupt trigger is positive edge sensitive.
- IE1=1 mean interrupt enable Timer 1.
- IE1=0 mean interrupt enable Timer 1.
- IE0=1 mean interrupt enable Timer 0.
- IE0=0 mean interrupt enable Timer 0.
-
IE
- EA=1 , enable this register’s use.
- EA=0 , disable this register’s use.
- ES=1, enable serial interrupt.
- ES=0, disable serial interrupt.
- ET2=1, enable Timer 2 interrupt (8052 feature).
- ET2=0, disable Timer 2 interrupt (8052 feature).
- ET1=1, enable Timer 1 interrupt.
- ET1=0, disable Timer 1 interrupt.
- ET0=1, enable Timer 0 interrupt.
- ET0=0, disable Timer 0 interrupt.
- EX1=1, enable external/hardware interrupt(INT1).
- EX1=0, disable external/hardware interrupt(INT1).
- EX0=1, enable external/hardware interrupt(INT0).
- EX0=0, disable external/hardware interrupt(INT0).