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
  • The manual for the compiler you are using - Keil I pressume - does describe how you declare bit variables. That should help you to modify the code until it gets accepted by your compiler.

    What do you call a library? A precompiled image linked with your application? In that case, it only works if you are using the same compiler as the library was built with.

    Or do you talk about a source code package that you compile and link with your project? In that case, the source code will probably also contain declarations that needs to be modified to be compatible with the compiler you are using.

Reply
  • The manual for the compiler you are using - Keil I pressume - does describe how you declare bit variables. That should help you to modify the code until it gets accepted by your compiler.

    What do you call a library? A precompiled image linked with your application? In that case, it only works if you are using the same compiler as the library was built with.

    Or do you talk about a source code package that you compile and link with your project? In that case, the source code will probably also contain declarations that needs to be modified to be compatible with the compiler you are using.

Children
  • i'm so sorry..
    it's not library that i mean..
    it's the headers..
    so sorry..
    i'm new in this stuff, that's why i tried to learn..
    i'm indonesian and in my area there's nobody studied about microcontroller and their stuff..
    so i can't ask for advice anywhere here..
    hope you don't mind sharing some of your knowledge..