SW006015 Microchip Technology, SW006015 Datasheet - Page 52

C COMPILER MPLAB C32

SW006015

Manufacturer Part Number
SW006015
Description
C COMPILER MPLAB C32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheets

Specifications of SW006015

Supported Families
PIC32MX5, MX6, And MX7
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC32 MCUs
Tool Function
Compiler
Supported Devices
PIC32 MCUs
Tool Type
Compiler
Processor Series
PIC32
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
3.4
DS51686A-page 48
ASSOCIATING A HANDLER FUNCTION WITH AN EXCEPTION VECTOR
®
# pragma interrupt function-name ipln [vector [@]vector-number [,
vector-number-list]]
# pragma interrupt function-name
Where n is in the range of 0..7, inclusive. The iplx specifier may be all uppercase or
all lowercase.
The function definition for a handler function indicated by an interrupt pragma must
follow in the same translation unit as the pragma itself.
The interrupt attribute will also indicate that a function definition is an interrupt
handler. It is functionally equivalent to the interrupt pragma.
For example, the definitions of foo below both indicate that it is an interrupt handler
function for an interrupt of priority 4.
#pragma interrupt foo ipl4
void foo (void)
is functionally equivalent to
void __attribute__ ((interrupt(ipl4))) foo (void)
There are 64 exception vectors, numbered 0..63 inclusive. Each interrupt source is
mapped to an exception vector as specified in the device data sheet. By default, four
words of space are reserved at each vector address for a dispatch to the handler
function for that exception source.
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 clause of the interrupt pragma, a separate vector pragma, or a vector
attribute on the function declaration.
3.4.1
The interrupt pragma has an optional vector clause following the priority specifier.
# pragma interrupt function-name ipl-specifier [vector
[@]vector-number [, vector-number-list]]
A dispatch function targeting the specified handler function will be created at the
exception vector address for the specified vector numbers. If the first vector number is
specified with a preceding “@” symbol, the handler function itself will be located there
directly.
For example, the following pragma specifies that function foo will be created as an
interrupt handler function of priority four. foo will be located at the address of exception
vector 54. A dispatch function targeting foo will be created at exception vector address
34.
#pragma interrupt foo ipl4 vector @54, 34
The following pragma specifies that function bar will be created as an interrupt handler
function of priority five. bar will be located in general purpose program memory (.text
section). A dispatch function targeting bar will be created at exception vector address
23.
#pragma interrupt bar ipl5 vector 23
Interrupt Pragma Clause
single [vector [@] 0
© 2007 Microchip Technology Inc.

Related parts for SW006015