* Interrupt is a signal that calls the ISR (Internet Service Routine)
* 8051 has 5 interrupts - 2 external ( hardware ) & 3 internal ( Timer 0, Timer 1, Serial )
Registers used for interrupts : Tcon , IE  & IP .
TCON register : ( 8 bit register )
 
                                         | TFO |  TR0  |  TF1 |  TR1 | IE1 |  IT1  |  IE0 |  IT0 |
                                               TIMER1      TIMER0              InterruptsIE0 / IE1  - if external interrupt is noticed. It sets the flag. 
IT0 / IT1 - when 0 specifies interrupt on falling edge 
                  when 1 specifies interrupt on low level.
Interrupt Enable register : ( 8 bit register )
 
                            | EA |  Res  |  Res |  ES | ET1 |  EX1  |  ET0 |  EX0 |
                                     EA - if 0 all interrupts disabled.
         if  1  all interrupts enabled.
ES -   if   0 all serial interrupts disabled.
          if  1  all serial interrupts enabled.
ET1 - Timer 1 interrupt (en/dis).
EX1 - External 1 interrupt (en/dis).
ET0 - Timer 0 interrupt (en/dis).
EX0 - External 0  interrupt (en/dis).
 
    
Interrupt Priority register : ( 8 bit register )
 
                            |  - |  -  |  - |  PS  | PT1 |  PX1  |  PT0 |  PX0 |
PS - Serial Interrupt.
PT1 - Timer 1.
PX1 - External 1.
PT0 - Timer 0.
PX0 - External 0.
SET any of these bit 1 if you want to prioritize your interrupts.
if you don't use IP register then predefined priority is :  External 0 (Priority 1)
                                                                                        Timer 0     (Priority 2)
                                                                                       External 1  (Priority 3)
                                                                                         Timer 1     (Priority 4)
                                                                                          Serial      (Priority 5)
                                     
 
 
Comments
Post a Comment