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

avoider robot

i need help.
i get this source code

#include <at89x51.h>
#include <delay.h>
#define usi P3_2 // ultrasonic in
#define uso P3_3 // ultrasonic out

unsigned char i;
bit x;

at 0x90 sbit md1; // left
at 0x91 sbit me1; //
at 0x92 sbit md2; // right
at 0x93 sbit me2; //

void cek_jarak()
{ TH0 = 0x00;
TL0 = 0x00;
TF0 = 0;
TF1 = 0;
usi = 1;
TR1 = 1;
while(!TF1);
TR1 = 0;
usi = 0;
while(!uso);
TR0 = 1;
while(uso);
TR0 = 0;
}

void perjalanan(bit a, bit b, bit c, bit d)
{me1= a; me2= b; md1= c; md2= d;}

void main()
{ TMOD = 0x21 ;
TCON = 0x00 ;
TH1 = 100;
while(1)
{ cek_jarak();
if(TH0 > 0x00) perjalanan(0,0,1,1);// forward
else
{ perjalanan(0,0,0,0);// backward
for(i=0; i<100; i++)delay(6000);
perjalanan(0,0,x,~x);// turn right/left
for(i=0; i<100; i++)delay(6000);
} x = ~x;
} }

but i cannot compile it.
can anybody help?

Parents
  • Don't you think that you should tell:
    1) What compiler was the source written for?
    2) What compiler do you have access to?
    3) What compiler errors do you get?
    4) What linker errors do you get?
    5) Have you looked in the manual what the errors mean?
    6) Have you tried to solve the errors?
    7) Have you googled for the errors?

Reply
  • Don't you think that you should tell:
    1) What compiler was the source written for?
    2) What compiler do you have access to?
    3) What compiler errors do you get?
    4) What linker errors do you get?
    5) Have you looked in the manual what the errors mean?
    6) Have you tried to solve the errors?
    7) Have you googled for the errors?

Children