dim912
Junior Member level 2
I am using "PIC MINI WEB" header board and it include PIC18F25J10. I wrote a very simple program and check the external interrupt. But unfortunately it is not working. Please tel me the fault I have done in programming.
IMPORTANT - (1) RB0 is pulled up.(grounded when the button is pressed)
(2) LED lights when RC2 pin goes to zero.
here is the code.
void interrupt(){
PORTC=0x00; //LED(connects to RC2)
Delay_ms(1000);
PORTC=0xFF; //LED off
INTCON.INT0IF=0;
INTCON.INT0IE=1;
}
void main() {
TRISB=0xFF;
TRISC=0x00;
//to check whether LED works.
PORTC=0x00 ;
Delay_ms(1000);
PORTC=0xFF ;
//above three lines work properly(LED lights for one second)
INTCON.GIE=1;
INTCON.INT0IE=1;
INTCON2.INTEDG0=0;//falling edge
while(1){}
}
IMPORTANT - (1) RB0 is pulled up.(grounded when the button is pressed)
(2) LED lights when RC2 pin goes to zero.
here is the code.
void interrupt(){
PORTC=0x00; //LED(connects to RC2)
Delay_ms(1000);
PORTC=0xFF; //LED off
INTCON.INT0IF=0;
INTCON.INT0IE=1;
}
void main() {
TRISB=0xFF;
TRISC=0x00;
//to check whether LED works.
PORTC=0x00 ;
Delay_ms(1000);
PORTC=0xFF ;
//above three lines work properly(LED lights for one second)
INTCON.GIE=1;
INTCON.INT0IE=1;
INTCON2.INTEDG0=0;//falling edge
while(1){}
}