User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
141
Interrupts
The PIC32MX generates interrupt requests in response to interrupt events from peripheral modules. The Interrupt
module exists external to the CPU logic and prioritizes the interrupt events before presenting them to the CPU.
The PIC32MX Interrupts module includes the following features:
- Up to 96 interrupt sources.
- Up to 64 interrupt vectors.
- Single and Multi-Vector mode operations.
- Five external interrupts with edge polarity control.
- Interrupt proximity timer.
- Module freeze in Debug mode.
- Seven user-selectable priority levels for each vector.
- Four user-selectable subpriority levels within each priority.
- User-congurable shadow set based on priority level (this feature is not available on all devices; refer to
the specic device data sheet for availability).
- Software can generate any interrupt.
- User-congurable interrupt vector table location.
ISRs are organized in IVT. ISR is dened as a standard function but with the iv directive afterwards which connects the
function with specic interrupt vector. For more information on IVT refer to the PIC32 Family Reference Manual.
Conguring Interrupts
The PIC32MX interrupt controller can be congured to operate in one of two modes:
- Single Vector mode - all interrupt requests will be serviced at one vector address (mode out of reset).
- Multi-Vector mode - interrupt requests will be serviced at the calculated vector address.
Single Vector Mode
In this mode, the CPU always vectors to the same address. This means that only one ISR can be dened.
The Single Vector mode address is calculated by using the Exception Base (EBase) address (its address
default is 0x9FC01000E). The exact formula for Single Vector mode is as follows: Single Vector Address =
EBase + 0x200.
Multi Vector Mode
In this mode, the CPU vectors to the unique address for each vector number. Each vector is located at a
specic offset, with respect to a base address specied by the EBase register in the CPU.
The individual vector address offset is determined by the following equation: EBase + (Vector_Number x
Vector_Space) + 0x200.
By default, the compiler congures interrupts in the Multi Vector mode, with the EBase address set to
0x9FC01000 and vector spacing of 32.
Conguring the Interrupt operating mode is performed in the Edit Project window.