rosh6270
Newbie level 1
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);
}
}
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);
}
}