SW500007 Microchip Technology, SW500007 Datasheet - Page 82

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
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
015P
778-1002
778-1002
Interrupt Handling in C
Both the low- and high-priority interrupt functions may use the interrupt level feature.
3.10.5 Interrupt Registers
It is up to the user how they want the interrupt source configured. All the registers and bits associated
with interrupts are defined in the specific header file which can be accessed by including <htc.h>.
The following is an example of setting up the interrupts associated with the change-on-PORTB
source. Interrupt priorities are used and the interrupt source is made a low priority. See your PIC18
datasheet for more information.
68
#pragma interrupt_level 1
void bill(){
}
/* two interrupt functions calling same non-interrupt function */
#pragma interrupt_level 1
void interrupt fred(void){
}
#pragma interrupt_level 1
void interrupt joe(void){
}
main(){
}
void main(void){
}
void interrupt low_priority b_change(void){
int i;
i = 23;
bill();
bill();
bill();
TRISB = 0x80;
IPEN = 1;
PEIE = 1;
RBIP = 0;
RBIE = 1;
RBIF = 0;
GIEL = 1;
while(1)continue; // sit here and wait for interrupt
if(RBIE && RBIF){
// Only RB7 will interrupt on change
// Interrupt priorities enabled
// enable peripheral interrupts
// make this a low priority interrupt
// enable PORTB change interrupt
// clear any pending events
// enable low-priority interrupts
C Language Features

Related parts for SW500007