Mar 5, 2013 #1 R rosh6270 Newbie level 1 Joined Mar 5, 2013 Messages 0 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,280 Activity points 1,280 The led connected to portc behaves funny when connected to the pic and doesnt seem to acknowledge the interrupt. unsigned char presence=0; void ISR(void) { if(INTCON.RBIF==1) { presence=1; INTCON.RBIF=0; } } void main(void) { TRISB=0x20;// rb5 is pir input TRISC=0x00; INTCON.GIE=1; INTCON.RBIE=1; while(1) { if(presence) // PIR Sensor { PORTC=~PORTC; // led output delay_ms(500); } }
The led connected to portc behaves funny when connected to the pic and doesnt seem to acknowledge the interrupt. unsigned char presence=0; void ISR(void) { if(INTCON.RBIF==1) { presence=1; INTCON.RBIF=0; } } void main(void) { TRISB=0x20;// rb5 is pir input TRISC=0x00; INTCON.GIE=1; INTCON.RBIE=1; while(1) { if(presence) // PIR Sensor { PORTC=~PORTC; // led output delay_ms(500); } }