Nuwan Tharaka
Newbie level 4
I am a beginner to Pic and wrote this code for Pic16f877 using mikroc. I want to know the error,this was written for led chaser forward and reverse.This code won't simulate in proteus.Please look into this!
Code:
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);
}
Last edited by a moderator: