User manual
146
mikoC PRO for dsPIC
MikroElektronika
For the sake of backward compatibility, user may write also :
void int1() org IVT_ADDR_U1RXINTERRUPT {
asm nop;
}
which is equivalent to :
void int1() iv IVT_ADDR_U1RXINTERRUPT {
asm nop;
}
Is is recommended that interrupts are handled in this way for the sake of better readability of the user projects.
Interrupt Example
Here is a simple example of handling the interrupts from Timer1 (if no other interrupts are allowed):
// Interrupt routine
void Timer1Int() iv IVT_ADDR_T1INTERRUPT {
//** it is necessary to clear manually the interrupt ag:
IFS0 = IFS0 & 0xFFF7; // Clear TMR1IF
//** user code starts here
LATB = ~ PORTB; // Invert PORTB
//** user code ends here
}