Nuwan Tharaka
Newbie level 4

I was following a tutorial in mikroc and there I experimented a code for getting a output (light a led) when a button is pressed;
there the author had used falling edge detection for the button and I have problem with understanding that part;I asked several persons and didnt get a satisfactory answer;
so I expect a simple and illustrated explanation as I am still getting to microcontrollers and C
the mcu is 16f877
the coloured code is very confusing to me
there the author had used falling edge detection for the button and I have problem with understanding that part;I asked several persons and didnt get a satisfactory answer;
so I expect a simple and illustrated explanation as I am still getting to microcontrollers and C
Code:
void main()
{
trisb.fo=0; // 0 bit is output led
trisb.f7=1; //7th bit is input button
option_reg.f7=0; // enable internal pullups
for(;;){
if(portb.f7==0){
[COLOR="#FF0000"]while(portb.f7==0){
delaly_ms(20);
}
portb.f0^=1;[/COLOR]
}
}
}
the coloured code is very confusing to me