USING INTERRUPTS ON THE HC11

  1. In the main program:
    1. Load Stack Pointer
      • Done for you in C
    2. Do any setup for interrupt
      • Set interrupt rate for Real Time Interrupt (RTR1:0 = 10)
        PACTL = (PACTL | 0x02) & ~0x01;
    3. Set Interrupt Vector
      • RTI_JMP = JMP_OP_CODE;
        RTI_VEC = rti_isr;
    4. Clear Interrupt Flag
      • TFLG2 = 0x40;
    5. Enable Specific Interrupt
      • TMSK2 = TMSK2 | 0x40;
    6. Enable Interrupts (Clear I Bit)
      • enable();
  2. In Interrupt Service Routine
    1. Handle Interrupt
      • PORTB = PORTB + 1;
    2. Clear Interrupt Flag
      • TFLG2 = 0x40;
    3. Exit with rti rather than rts.
      • #pragma interrupt_handler rti_isr