ecaits
Member level 4
- Joined
- Jan 16, 2014
- Messages
- 76
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 579
I want to use external interrupt in pic16f877 but cannot get the interrupt. Code is given below.
Why it is not getting ???
I am using switch on RB0 pin and want to toggle the RB1 pin connected with LED.
Plz support.
Why it is not getting ???
I am using switch on RB0 pin and want to toggle the RB1 pin connected with LED.
Plz support.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include<htc.h> #include<pic.h> void main() { TRISB0=1; TRISB1=0; // Configure PortD as output port // INTCON=0x90; // Enable INT0 // INTCON2=0; // Set Falling Edge Trigger for INT0 GIE = 1; INTE = 1; OPTION = 0x40; // INTCON.GIE=1; // Enable The Global Interrupt while(1) { // LATB=0x55; //Set some value at PortD } } void interrupt ISR(void) // Interrupt ISR { if(INTF==1) { INTF=0; // Clear the interrupt 0 flag RB1=~RB1; } // Invert (Toggle) the value at PortD // Delay_ms(1000); // Delay for 1 sec }
Last edited by a moderator: