SW500008 Microchip Technology, SW500008 Datasheet - Page 80

PICC-18 STD

SW500008

Manufacturer Part Number
SW500008
Description
PICC-18 STD
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500008

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Standard
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015
778-1001
778-1001
Interrupt Handling in C
A low-priority interrupt function may be defined as in the following example.
It is up to the user to determine and set the priority levels associated with each interrupt source on
the PIC18 devices. Defining a low-priority interrupt function does not put the PIC into interrupt-
priority mode.
to save context, thus a high-priority interrupt function may interrupt a low-priority interrupt
function with no loss of data. The high-priority interrupt can also employ the devices’ shadow
registers to enable rapid context switching during the entry and exit of the service routine.
usual way.
3.10.2 Context Saving on Interrupts
The PIC18 processor only saves the program counter on its stack whenever an interrupt occurs.
Other registers and objects must be saved in software. PICC-18 automatically determines which
registers and objects are used by an interrupt function and saves these appropriately.
code in the same module, then any registers used by these functions will be saved as well. If the
called functions have not been seen by the compiler, a worst case scenario is assumed and all registers
and objects will be saved.
register usage. Thus, if you include in-line assembly code into an interrupt function, you may have
to add extra assembly code to save and restore any registers or locations used if they are not already
saved by the interrupt entry routine.
nique where the W, STATUS and BSR registers are saved and restored via the devices’ internal
shadow registers. This minimizes code size and reduces the instruction cycles to access the high-
priority service routine. Note that for some older devices, the compiler will not apply fast interrupt
save/restore if compiling for the MPLAB ICD2 debugger, as the debugger istself utilizes these
shadow registers.
called intcode which is linked directly to the interrupt vector. This code saves the STATUS (if fast
interrupts are not used) and PCLATH registers then jumps to code placed in a text psect. This code
66
Low- and high-priority interrupt functions have their own separate areas of memory in which
The interrupt_level pragma may be used with either or both interrupt functions in the
If the interrupt routine calls other functions and these functions are defined before the interrupt
PICC-18 does not scan assembly code which is placed in-line within the interrupt function for
By default, the high-priority interrupt function will utilize a fast interrupt save/restore tech-
The high-priority or compatibility-mode interrupt function places a small routine in a psect
}
void interrupt low_priority tc_clr(void){
}
tick_count = 0;
C Language Features

Related parts for SW500008