Техническая Спецификация для Microchip Technology SW006023-2N

Скачать
Страница из 238
MPLAB
®
 XC32 C/C++ Compiler User’s Guide
DS51686E-page 142
 2012 Microchip Technology Inc.
11.6.1
Context Restoration
Any objects saved by software are automatically restored by software before the inter-
rupt function returns. The order of restoration is the reverse to that used when context 
is saved.
11.7
LATENCY
There are two elements that affect the number of cycles between the time the interrupt 
source occurs and the execution of the first instruction of your ISR code. These are:
• Processor Servicing of Interrupt – The amount of time it takes the processor to 
recognize the interrupt and branch to the first address of the interrupt vector. To 
determine this value, refer to the processor data sheet for the specific processor 
and interrupt source being used.
• ISR Code – The compiler saves the registers that were used by the ISR. This 
includes the TODO registers. Moreover, if the ISR calls an ordinary function, then 
the compiler will save all the working registers, even if they are not all used explic-
itly in the ISR itself. This must be done, because the compiler cannot know, in 
general, which resources are used by the called function.
11.8
NESTING INTERRUPTS
Interrupts may be nested. The interrupt priority scheme implemented in the PIC32 
architecture allows you to specify which interrupt sources may be interruptible by 
others. See your device data sheet for explicit details on interrupt operation.
11.9
ENABLING/DISABLING INTERRUPTS
Macros are available in the PIC32 peripheral library to control aspects of interrupt 
operation. See the Microchip PIC32MX Peripheral Library documentation for more 
information.
11.10 ISR CONSIDERATIONS
There are few issues arising with interrupt functions.
As with all compilers, limiting the number of registers used by the interrupt function, or 
any functions called by the interrupt function, may result in less context switch code 
being generated and executed by the compiler, seSection 11.7 “Latency”. Keeping 
interrupt functions small and simple will help you achieve this.