This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

check rc car code in c using 89c51 uc

i am working on 89c51 uc is this code correct for rc car.

#include<stdio.h>
#include<Regx51.h>

sbit t0=P1^0;
sbit t1=P1^1;
sbit t2=P1^2;
sbit t3=P1^3;
sbit t4=P2^0;
sbit t5=P2^1;
sbit t6=P2^2;
sbit t7=P2^3;
sbit t8=P2^4;
sbit t9=P1^5;
sbit t10=P1^6;
sbit t11=P1^7;
sbit t12=P2^5;
sbit t13=P2^6;
sbit t14=P2^7;

void main()
{

t9=t10=t11=t12=t13=t14=0; t0=1; t1=1;t2=1;t3=1;//t3=t2=t1=t0=1; for(; ;) { l1: if(t0==0) //left { t4=1; t5=1; t6=t7=t8=0; goto l1; } l2:if(t1==0) //right { t6=1; t7=1; t4=t5=t8=0; goto l2; } l3:if(t2==0) //forward { t7=1; t4=t5=t6=t8=0; goto l3; } l4:if(t3==0) //reverse { t8=1; t4=t5=t6=t7=0; goto l4; }

}
}

Parents
  • I can see that you are confused.

    You obviously have to ask the RC car. Or maybe the electronics board that you plan to mount your processor on.

    But the RC car may become enraged if it notices that you are using goto statements in your code. That means you really don't love your RC car, and have decided to go all BASIC on it.

Reply
  • I can see that you are confused.

    You obviously have to ask the RC car. Or maybe the electronics board that you plan to mount your processor on.

    But the RC car may become enraged if it notices that you are using goto statements in your code. That means you really don't love your RC car, and have decided to go all BASIC on it.

Children