Guys. I would like to initiate an interrupt caused by changes of Port RB7. The following code is written by me and the LED cannot light once the state of Port RB7 is changed. I am using microC pro in programming. The RBIF is actually used read the position of motor using the quadrature encoder attached to the motor. So, there will be 2 RB ports used and interrupt will be induced if either of the RB ports changes their state.
#define LED1 PortA.F7
void interrupt(){
if(INTCON.RBIF==1)
{
LED1=1;
delay_ms(500);
LED1=0;
INTCON.RBIF=0;
}
}
void main ()
{
TRISA = 0;
TRISB = 0b10000000;
INTCON = 0b01001000;
while (1)
{
}
}