17.3 Associating a Handler Function with an Exception Vector

For PIC32 devices, each interrupt source is mapped to an exception vector, as specified in the device data sheet. For devices with a constant vector spacing, a default of four words of space are reserved at each vector address for a dispatch to the handler function for that exception source. For devices with a variable vector spacing, the default linker script adjusts each vector's spacing for the size of the designated interrupt function.

An interrupt handler function can be associated with an interrupt vector either as the target of a dispatch function located at the exception vector address, or as being located directly at the exception vector address. A single handler function can be the target of multiple dispatch functions.

The association of a handler function to one or more exception vector addresses is specified via a vector attribute on the function declaration. For compatibility purposes, you may also associate a handler function to a vector address using a clause of the interrupt pragma, a separate vector pragma, or a vector attribute on the function declaration.