10.14.4 Code Examples

Enable Global Interrupts

void enableInterrupts (void) 
{ 
/* Enable level 1-7 interrupts */ 
/* No restoring of previous CPU IPL state performed here */ 
INTCON1bits.GIE = 1;
}

Disable Global Interrupts

void disableInterrupts (void) 
{ 
/* Disable level 1-7 interrupts */ 
/* No restoring of previous CPU IPL state performed here */ 
INTCON1bits.GIE = 0;
}

ISR for Timer 1 Interrupt

void __attribute__((interrupt, context)) _T1Interrupt(void) 
{ 
/* Insert ISR Code Here*/
/* Clear Timer1 interrupt */ 
IFS1bits.T1IF = 0;
 }