---
+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Newbie level 1
    Points: 1,133, Level: 7

    Join Date
    Aug 2006
    Posts
    1
    Helped
    0 / 0
    Points
    1,133
    Level
    7

    line follower using at89c51

    Hi every one...........

    I have project build robot line follower with AT89C2051 and i have list program on C language like this :

    #include d:\mc51\8051io.h
    #include d:\mc51\8051reg.h
    extern register unsigned char speedleft,speedright;
    register unsigned char high,low,flag,time;

    main()
    {
    P1=0x40;
    P3=0xff;
    high = 80;
    low = 30;
    flag = 0;
    time = 50;
    Start();
    while(1) {
    P3|= 0x0f;
    Run();
    }
    }

    Start()
    {
    char exit,key;
    exit =1;
    while(exit)
    {
    key = P1;
    if((key & 0x40)==0) exit=0;
    }
    }

    Run()
    {
    char sensors;
    sensors = (P3 &=0x0f);

    if((sensors & 0x01)==0) {
    TurnRight();
    flag = 1; }

    else if((sensors & 0x08)==0) {
    TurnLeft();
    flag = 2; }
    else if(sensors == 0x09) {
    Forward(high);
    flag = 0; }

    else if(((sensors==0x0b)||(sensors==0x0d))&&(flag==0))
    Forward(low);

    }

    Forward(char speed)
    {
    P1=0x64;
    speedright = speed+10;
    speedleft = speed;
    delay(time);
    }

    TurnRight()
    {
    P1=0x68;
    speedright = low+5;
    speedleft = low;
    delay(time);
    }

    TurnLeft()
    {
    P1=0x54;
    speedright = low+5;
    speedleft = low;
    delay(time);
    }

    Reverse(char speed)
    {
    P1=0x58;
    speedright = speed;
    speedleft = speed+5;
    delay(time);
    }

    Now, I'm not understand about this programs, please help me.
    but away if this programs (C language), How build to Assembly?

    I waiting all answer, n Thanks 4 all of your attaention.

    •   Alt23rd August 2006, 06:17

      advertising

        
       

  2. #2
    Full Member level 1
    Points: 2,038, Level: 10

    Join Date
    Apr 2005
    Posts
    110
    Helped
    6 / 6
    Points
    2,038
    Level
    10

    line follower program

    first of all you should get a software that compiles c language program into assembly language

    e.g. keil uVision....go to www.keil.com

    by the way, did u write this program or did u get it from somewhere?

    and then burn it onto the 8051 chip



+ Post New Thread
Please login