CrazyEngineers
  • shahanirohit

    shahanirohit

    MemberAug 17, 2011

    Obstacle avoiding robot - Microcontroller Programming

    guys i m makin an obstacle avoidng robot with 2 dc geared motors, a sharp ir sensor, nd nxp microcontroller p89v51rd2bn i m having problem in programmign de microcontroller . using keil i m making a hex file to burn the data into microprocessor . can u guys suggest me some programs code to make hex file i m having problem in tat

    #include
    #define forward 0x05; //0000 01 01 both motors in forward
    #define reverse 0x0a; //0000 10 10 both motors in reverse
    #define leftturn 0x06; //0000 01 10 left motor =backwards,
    //right motor=forward
    #define rightturn 0x09; //0000 10 01 left motor=forward
    //right motor=backwards
    #define obst P2
    void main()
    { int P1,P2;
    P1=0xff; //intialize PORT1 as input(sensors)
    P2=0x00; //intialize PORT2 as output(motors)
    if(obst==0) //Check if sensor has detected an obstacle
    { P2=reverse;
    P2=rightturn;
    } else
    { P2=forward; //else go forward
    }


    this is my program i hav searched for but it is showing in keil tat header file cant be read ? why ? can u correct this program or suggest me some obstacle avoiding robo progams for my microprocessor
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Shobhan Mankad

    MemberAug 21, 2011

    check if the header file that you have included the (.h) file is present within the Keil directory. if not you need to,
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register