I have a problem setting up Interrupt Service Routine for PIC24F08KA101.
I have successfully initialized IE,IF,IP for interrupts which I need to use.
Part of the code which initializes these:
void
int_init(void)
{
IEC1bits.INT2IE=1; //Enable Interrupt
IFS1bits.INT2IF=0; //Clear Interrupt Flag
INTCON2bits.INT2EP=0; //activate on positive edge
IPC7bits.INT2IP=3; //Set priority (higher gets executed first)
IEC0bits.T1IE=1; //Enable Interrupt
IFS0bits.T1IF=0; //Clear IF
IPC0bits.T1IP=2; //Set priority
}
I have checked them from the PIC24F08KA101.h. The clock prescaler is not shown in this code.
I have problem initializing ISR for INT2 (External interrupt port 2) and T1 (timer1). I tried to use this ISR, but it does not work. Got it from code examples.
void __attribute__((interrupt,no_auto_psv)) _INT2Interrupt(void); //Declare
void
__attribute__((interrupt,no_auto_psv)) _INT2Interrupt(void)
{
//Do stuff here
}
I tried the same for timer1, but it does not work too.
I use HI-TECH for dsPIC/PIC24 V9.62 compiler.
INT2 is selectable port for the PIC I use.