Download DEVELOPMENT OF INTELLEGENT MOBILE PLATFORM

Transcript
void MoveP_LR(void)
{
ch=0;
ch=Control[1];
if(ch=='0')
{
if(C1==25)
{
PORTF^=0x04;
__delay_cycles(22000);
//Neutral
PORTF^=0x04;
}
if(C1<=24)
{
C1++;
PORTF^=0x04;
__delay_cycles(15000);
//Start point
i=C1;
while(i>0){ __delay_cycles(280);i--;}
PORTF^=0x04;
}
if(C1>=26)
{
C1--;
PORTF^=0x04;
__delay_cycles(15000);
//Start point
i=C1;
while(i>0){ __delay_cycles(280);i--;}
PORTF^=0x04;
}
}
if((ch=='R')&&(C1>=0))
{
if(C1!=0){C1--;}
PORTF^=0x04;
__delay_cycles(15000);
//Start point
i=C1;
while(i>0){ __delay_cycles(280);i--;}
PORTF^=0x04;
}
if((ch=='L')&&(C1<=50))
{
if(C1!=50){C1++;}
PORTF^=0x04;
__delay_cycles(15000);
//Start point
i=C1;
while(i>0){ __delay_cycles(280);i--;}
PORTF^=0x04;
}
}
113