next up previous
Next: What is Pulse Width Up: Output Compare Interrupts Previous: Writing the ISR

Declaring the ISR's Interrupt Vector

The final thing we need to do is declare the interrupt vector associated with our ISR. This is accomplished using another pragma. The following code segment associates our ISR function OC4han() with the interrupt vector for the OC4 event.

  extern void OC4han();
  #pragma abs_address: 0xffe2
  void(* OC4_handler[])()={ OC4han };
  #pragma end_abs_address

This code segment tells the compiler to install the ISR OC4han() at the absolute address 0xFFE2. This hex address is the absolute address for the OC4 event's interrupt vector (refer back to the earlier table of interrupt vectors). With these lines of code we've tied our ISR OC4han to the OC4 hardware event.

Bill Goodwine 2002-09-29