It's common for embedded systems to be real time systems which need to process information as it arrives and take some action immediately. Processors provide interrupts specifically for this, where normal program execution is suspended whilst an interrupt service routine is executed, finally returning to normal program execution when the interrupt is finished.

The supports many interrupt sources; these are chip-specific and you can find the exact interrupt sources from each processor's data sheet.

You define an interrupt function just like a standard C function, but in addition you tell the compiler that it is an interrupt function and optionally which vectors to use. The compiler generates the correct return sequence for the interrupt and saves any registers that are used by the function. Note that the name of the interrupt function is not significant in any way.

###### Initializing a single interrupt vector

    void handle_timer_interrupt(void) __interrupt[TIMER_VECTOR]
    {
      /* Handle interrupt here */
    }

This constructs an interrupt function called handle_timer_interrupt and initializes TIMER_VECTOR in the processor's interrupt vector table to point to handle_timer_interrupt.

###### Initializing a multiple interrupt vectors

    void
    handle_spurious_interrupt(void) __interrupt[UART0_RX_VECTOR,
                                                UART0_TX_VECTOR,
                                                ACCVIO_VECTOR]
    {
      /* Handle interrupt here */
    }

This constructs an interrupt function called handle_spurious_interrupt and initializes the three vectors UART0RX_VECTOR, UART0_TX_VECTOR, and ACCVIO_VECTOR in the processor's interrupt vector table to point to handle_spurious_interrupt.

###### Simple interrupt handler

    void handle_pluggable_interrupt(void) __interrupt
    {
      /* Handle interrupt here */
    }

This constructs an interrupt function called handle_pluggable_interrupt but does not initialize the interrupt vector table. This style of interrupt function is useful when you plug different interrupt routines into a RAM-based table to dynamically change interrupt handlers when the application runs.