Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Thread Tools Display Modes
Old 2nd February 2007, 04:05 PM   (permalink)
Default Line Follower Robot

Can any one tell me how can I compile this c program of 89c2051 :-



#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);
}
pankajchaudhari27 is offline   Reply With Quote
Old 3rd February 2007, 06:07 AM   (permalink)
akg
Default

using keil (??)
__________________
Gods own Country
Incredible !ndia

www.flickr.com/photos/_akg/

"Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime."
akg is offline   Reply With Quote
Old 3rd February 2007, 08:54 PM   (permalink)
Default

pressing compile button?
__________________
Need Help?
Press F1
If that doesn\'t help you, ask me... I might know better.
bloody-orc is offline   Reply With Quote
Old 6th April 2008, 12:46 PM   (permalink)
Default

i try to find error but it cant
I fint ur code in page of David cook
phuanon is offline   Reply With Quote
Old 6th April 2008, 02:03 PM   (permalink)
Default

Detail man! Compile it to run on what? Where did you write it? In an IDE? What MCU, if any, are you going to be ultimately using it for?
__________________
If it is broken, let's fix it.
If it is working, let's make it better.
NightFalcon90909 is offline   Reply With Quote
Old 11th April 2008, 05:44 AM   (permalink)
Default

OP has posted exactly once, 14 months ago. Probably isn't checking here for a solution.
mneary is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
line follower robot program UnD3aD Robotics Chat 2 23rd October 2007 08:13 AM
line follower robot manojharihar Electronic Projects Design/Ideas/Reviews 2 10th December 2006 07:59 AM
Line follower robot Sherif Welsen Robotics Chat 3 21st July 2004 12:05 PM
Stepper motor and line follower robot muhammad108 Robotics Chat 3 15th May 2004 10:29 AM
line follower robot dxa Robotics Chat 3 29th December 2003 03:48 PM



All times are GMT. The time now is 05:12 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.