Nuwan Tharaka
New Member
C:
run();
reverse();
void main()
{
trisb=0;
}
run()
{
portb=1;
delay_ms(100);
do{
portb=portb<<1;
if(portb.f4>=1)
{
delay_ms(100);
reverse();
}
}
while(1);
}
reverse()
{
portb=0b00010000;
delay_ms(100);
do{
portb=portb>>1;
if(portb.f0<=1)
{
delay_ms(100);
main();
}
}
while(1);
}
this code was written with mikro c for led chaser to light up leds one by one in forward direction and then backwards using pic16f877.it compiles well in the compiler but when i simulated it in proteus the leds are not lit as expected,random leds are lit instead.so what could be the reason for that?please someone explain me the mistakes in it.
Last edited by a moderator: