السلام عليكم
ارجو المساعدة في معرفة الخلل في هذا الكود وهو عدم العد بشكل صحيح عند تحقق الشرط
وشكرا
كود:
#define KeyPulse portb.f0
void main(){
signed char x;
cmcon=0x07;
trisb=0b00001111;
trisa=0b00000000;
portb=0;
porta=0;
porta.f1=1; delay_ms(2000);
porta.f1=0; delay_ms(20);
loop:
for (x=0; x<2; x++)
while (KeyPulse == 0){}
delay_ms(50);
while (KeyPulse ==1 ){}
delay_ms(50);
if((portb.F1==1)&&(portb.F2==1)&&(portb.F3==1))
{portb.F5=1;delay_ms(1000);portb.F5=0;}
for (x=0; x<3; x++)
while (KeyPulse == 0){}
delay_ms(50);
while (KeyPulse == 1){}
delay_ms(50);
if((portb.F1==1)&&(portb.F2==1)&&(portb.F3==0))
{portb.F5=1;delay_ms(1000);portb.F5=0;}
goto loop;
}