line follower

24 replies [Last post]
srivardhan
Offline
Last seen: 1 year 45 weeks ago
Joined: 2010-03-11
bOt Points: 54

 hey i got one doubt in the given program, in while loop ,there is 

   if((P1_0==0)&&(P1_4==1))

                                                TurnRight();

                                else if((P1_0==1)&&(P1_4==0))

                                                TurnLeft();

                                else

                                                Forward();

when p1_0==0 left sensor will b off and when p1_4==1 right sensor works and it rotates then it should take left turn..am i right?

if wrong plzz..xplain me..

bharatgarg
Offline
Last seen: 29 weeks 5 days ago
Joined: 2011-01-03
bOt Points: 66
http://www.botskool.com/image

http://www.botskool.com/images/elec/ioi87.jpg

the image shows 2 LED circuit.

Are these for emitter and reciever?

and are they only sufficient circuit for emitter and reciever? ( I bought emitter and detector from a shop

and he gave me a circuit with 2 led + 1 resistor+input pins.)

Thanx shashwat sir for the valuable advise.

rxcompiler
Offline
Last seen: 51 weeks 6 days ago
Joined: 2010-07-30
bOt Points: 54
i love this online

i love this online compiler....as a student it really helps me ...my teacher was impress with me ...

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
Yes you can use L293B also. 

Yes you can use L293B also. 

ethiraj
Offline
Last seen: 1 year 22 weeks ago
Joined: 2010-08-28
bOt Points: 58
 what is the value of the

 what is the value of the pot 

ethiraj
Offline
Last seen: 1 year 22 weeks ago
Joined: 2010-08-28
bOt Points: 58
 hi can we use l293d instead

 hi can we use l293d instead of l293b

 

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
hey..

 hai ther i program it ready...but my robot not working...why...ther is NO output from the 8051..when i used multimeter to check the output of the p0.0,p0.1,p0.2,p0.3,p0.4,p0.5..ther is only got voltage in port p0.0 and p0.4...others all it jus show 0v.....as i know the po.0 and p0.4 is the ENABLE port rite for L293 chip...why????

sivan

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
ohw....

 ok...i understand.....ok lets say i wan to modify the given code.bcos i wan make it to avoid things..

as in the link below plz c the video and suggest me a idea what can i do to make it like that and its that i need to change the header or only the source code..

http://www.youtube.com/watch?v=kBKhaMfIGbs

sivan

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
You are welcome.  See the

You are welcome.  See the terms used in code such as P0_0 (pin 0 of port 0), P0_1 (pin 1 of port 0) etc these are all microcontroller related specific terms and compiler doesn't recognize them by default. So like normal variables they have to be defined somewhere. In this case all the terms related to AT89S52 microcontroller are defined in this header file. Thats why it is necessary to include this header file. 

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
thanks..

 thanks you very much....ok i jus wan to know ..whats the used of the .H (header file)...can u explain me why....let say i wan to modify this program bcos wan to do line follower avoiding obstacle..... 

sivan

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
Download Keil C IDE and then

Download Keil C IDE and then compile your code. Follow this link - http://www.keil.com/demo/eval/c51.htm.

Also you have mentioned that you are unable to download hex file. To download it right click on the hex file link given on line follower tutorial page and choose Save Link As/Save Target As option. 

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
HELP ME

 i need ur valueble HELPS

sivan

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
hai.....

ok....can u help me to compiler the .c and send to my mail " weird_c1@yahoo.com " so at least i can burn it in to my microcontroler so that i can check out my robot can work or not..can ah

sivan

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
im using

 DEVc++  ...... yar it in same folder...

sivan

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
Hi sivan000, The

Hi sivan000,

The linefollower.c file and hex file should be in the same folder. Which compiler are you using?

Download the Keil C compiler from here - http://www.keil.com/demo/eval/c51.htm

If its really urgent then you can also directly download the hex file from line follower tutorial page. 

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
problem again

 its still saying the same problem........why...i dun understand ...i never modify anything only i jus download it and try to compiler it..but cn nt....is that my compiler problem...its like that mean ,,cn u suggest me any web to download it nw!!...plzzz help ME

sivan

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
ok..

 mean i jus download both of it...and jus put it in my desktop and try to compile it rite

sivan

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
You need to include AT89X52.h

You need to include AT89X52.h header file. Download it from line follower tutorial webpage and place it in C:\Users\chuan\Desktop and then try and compile your program again.

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
hai.....

i have tried also ..but the error it say sumthing like this

C:\Users\chuan\Desktop\linefollower.c:1:21: AT89X52.h: No such file or directory
C:\Users\chuan\Desktop\linefollower.c: In function `Forward':
C:\Users\chuan\Desktop\linefollower.c:27: error: `P0_1' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:27: error: (Each undeclared identifier is reported only once
C:\Users\chuan\Desktop\linefollower.c:27: error: for each function it appears in.)
C:\Users\chuan\Desktop\linefollower.c:28: error: `P0_2' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:29: error: `P0_3' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:30: error: `P0_5' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c: In function `TurnLeft':
C:\Users\chuan\Desktop\linefollower.c:37: error: `P0_1' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:38: error: `P0_2' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:39: error: `P0_3' undeclared (first use in this function)C:\Users\chuan\Desktop\linefollower.c:40: error: `P0_5' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:42: error: `P0_0' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:44: error: `P0_4' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:45: error: `P0_6' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c: In function `TurnRight':
C:\Users\chuan\Desktop\linefollower.c:55: error: `P0_1' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:56: error: `P0_2' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:57: error: `P0_3' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:58: error: `P0_5' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:60: error: `P0_0' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:62: error: `P0_4' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:63: error: `P0_6' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c: In function `main':
C:\Users\chuan\Desktop\linefollower.c:72: error: `P1_0' undeclared (first use in this function)
C:\Users\chuan\Desktop\linefollower.c:73: error: `P1_4' undeclared (first use in this function)

C:\Users\chuan\Desktop\linefollower.c:70: warning: return type of 'main' is not `int'Execution terminated 

 

so whats the problem..i dun understand how to included the header file - AT89X52.h...

i hv download both .H and .C but i cn nt download the .hex file

sivan

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
Hi sivan000, I tried

Hi sivan000,

I tried compiling the code and it compiled successfully. Have made any modifications to the code? Make sure that you have included the header file - AT89X52.h.

You can also directly download the hex file given in line follower tutorial. 

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
if can

i think there is sum problem in sum were in c or my computer...so cn i get the .hex file can any wan compiler it and give me...cn do it like tat ah....bcos i need it as fast as can ...u guys realy helpful ......

sivan

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
yes ah DeAviator

 realy thanks for ur help....but went i compiler the c file its show sum error, why ah..and whats the used of the h(header) file the given.... 

sivan

DeAviator
Offline
Last seen: 1 year 17 weeks ago
Joined: 2009-04-14
bOt Points: 138
Use the linefollower.c file

Use the linefollower.c file in C compiler IDE like kiel c software, which will generate a .hex file .. use this hex file to program your micro controller. Thats all. The c code is correct. Hope it helps

sivan000
Offline
Last seen: 1 year 44 weeks ago
Joined: 2010-01-26
bOt Points: 118
hai.....

 hey guyz  i got a problem....based on this  webpage i have created a line follower robot exactly.The problem is now that i am not sure whats the use of the three file below and which one of the following files should i burn into my microprocessor chip.My knowledge in programming is just basic. After compiling the source code given (linefollower.c).Is the given  program  correct or there is any problem....Pls help me as soon as possible anyone.

Download c program file - linefollower.c

Download hex file – linefollower.hex

Download AT89X52.h header file

sivan

shashwat
Offline
Last seen: 2 weeks 4 days ago
Joined: 2009-02-18
bOt Points: 1128
Hi srivardhan, This code is

Hi srivardhan,

This code is for bOt following a white line on black surface. So the condition (P1_0==0)&&(P1_4==1) implies that left sensor is on black surface and right sensor is on white line right now i.e. the bOt is drifting to left hand side. To correct this we need to take a right turn and hence the TurnRight() function has been called.