The 8 sensors are connected the port 0 .The numbers 160 n 255 are a constant
which u take this has been explained un my previous post so jst take a look.
while (1){
#ifdef debug
if(rep<255) prev="PINA;" i="0;i<8;i++)">>i)&0x01);
rep=0;
}
#endif
if(PINA!=255){
rotpow=255;
ldev=rdev=0;
if(PINA.3==0)
rdev=1;
if(PINA.2==0)
rdev=2;
if(PINA.1==0)
rdev=3;
if(PINA.0==0)
rdev=4;
if(PINA.4==0)
ldev=1;
if(PINA.5==0)
ldev=2;
if(PINA.6==0)
ldev=3;
if(PINA.7==0)
ldev=4;
if(rdev>ldev)
move(R,0,195+12*rdev);
if(rdev<160) rotpow="160;}">HMAX)
{move(CW,0,rotpow);}
else
{move(CCW,0,rotpow);}
}
};
}
void move (unsigned char dir,unsigned char delay,unsigned char power) {
PORTC=dir;
if(dir==L || dir==R) {
hcount=(hcount+1)%MAX;
history[hcount]=dir;
}
LSPEED=RSPEED=255;//power;
//delay_ms(delay);
}
This is taken from priyank patels LFR code .
Komli
Saturday, May 17, 2008
A part of the Source Code for the Previous LFR
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment