لقد علقت على ما فهمت . لو تتكرم و تعلق على الاوامر الاخرى
جزاك الله خيرا
void main()
{cmcon=7; // deactive comparator
trisd=1;trisb=0;portb=0; // all pin D input ; All pin B output ; all pin B 5 v
while(1){ //repeat
if(portd.f0==0) // if button pressed
{portb=1; delay_ms(1000); // B0 on ; wait 1sec
if(portd.f0==0) // if button pressed
{portb=3; delay_ms(1000); // B0 and B1 on ; wait 1sec
if(portd.f0==0) // if button pressed
{portb=7; delay_ms(1000); // B0 and B1 and B2 on ; wait 1sec
while(portd.f0==0){}
portb=5;delay_ms(1000);
portb=4;delay_ms(1000);
portb=0;
}
else {portb=1; delay_ms(1000);
portb=0;}
}
else portb=0;
}
}
}