I'm stuck with a simple program..
This Is what I want to do.
Blinking LEDs of PortD in every time. (infinite loop) ---Working without a problem
Stop Blinking when Interrupt Received on INT0.
-Interrupt received correctly. But I cannot exit from the while loop. I know This can be done by setting a flag in the interrupt routine and checking the while condition while(flag). But I want to do an intimidate exit from the loop without going to the while loop condition.
Here is the chord.... Please Help me
Code: Select all
void interrupt(){ // Interrupt rutine
if(INT0IF_bit==1 ){
INT0IF_bit=0;
PORTD=0;
}
}
Blinking(){
while(1){
PORTD = 15;
Delay_ms(50);
PORTD = 0;
Delay_ms(50);
//Some more chords comes here
///////////////////////
}
}
void main() { // Main program
ADCON0 = 0;
ADCON1 = 15;
TRISB=1; // Set PB7 as input
TRISD =0; // Set PortD as output
TRISC=0;
// RBIE_bit = 1;
// RBIP_bit=0;
INT0IE_bit=1;
INTEDG0_bit=1;
GIE_bit = 1; // Global Interrupt Enable
Blinking();
}