thannara123
Advanced Member level 5
I have a program to ON and OFF a device , the following program [MPLab Pic16f877a controller Simulation on Proteus)
string("Press to ON ");
__delay_ms(500);
while(PORTDbits.RD7==0);
while(PORTDbits.RD7==1)
{
PORTDbits.RD7==0; // flush again the press
// working code
}
First it will operate normally ,and the second iteration the while loop excuted without pressing my RD7 switch .
what is the reason ?
string("Press to ON ");
__delay_ms(500);
while(PORTDbits.RD7==0);
while(PORTDbits.RD7==1)
{
PORTDbits.RD7==0; // flush again the press
// working code
}
First it will operate normally ,and the second iteration the while loop excuted without pressing my RD7 switch .
what is the reason ?