Hello guys, I'm having problem with my external interrupts using pic16f877a. I can't make the interrupt service routine run. The command "portc.f0 = ~portc.f0;" should be executed when the logic state is changed either from 0 to 1 or 1 to 0 on the pin 1 of PORTB.
Here's my code:
I hope you can help me. Thank you.
Here's my code:
Rich (BB code):
void interrupt(void){
if (pir1.rbif == 1){
portc.f0 = ~portc.f0; //invert the state of output to see an if an interrupt occured
pir1.rbif = 0;
}
}
void main() {
ADCON1 = 0x06;
CMCON = 0x07;
TRISB = 0xFF;
TRISC = 0x00;
portc = 0x00;
intcon.rbie = 1;
intcon.gie = 1;
while(1) {
delay_ms(1);
}
}