Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem in my line following robot program can any one plz help me

Status
Not open for further replies.

ksdeepstar

Newbie level 4
Joined
Feb 6, 2011
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
//PORTA pin 0 = right sensor
//PORTA pin 1 = left sensor
//PORTA pin 0 = left motor forward
//PORTA pin 1 = left motor backward
//PORTA pin 2 = right motor forward
//PORTA pin 3 = right motor backward

void main()
{
set_tris_a(0xff);
set_tris_b(0x00);
while(1)
{
if(!input_state(pin_A0)&& !input_state(pin_A1))// go forward
{
output_b(0x05);
}
if(input_state(pin_A0)&& input_state(pin_A1))//left turn
{
output_b(0x06);
}
if(!input_state(pin_A0)&& !input_state(pin_A1))// right turn
{
output_b(0x09);
}
if(input_state(pin_A0)&& input_state(pin_A1))// go back
{
output_b(0x0A);
}
 

Please explain your problem in details if you want to get helped.

However, as I can see from your code that you are setting PORTA as an output port and, in the same time you connect the sensors to this output port.
//PORTA pin 0 = right sensor
//PORTA pin 1 = left sensor
...
set_tris_a(0xff); ------------> This sets the whole port to be output

You either connect the sensors to portB or use TrisA = 0xFC
 

Port A is analog..make sure you have disable analog module..set all pin to digital..
 

thank u but i encourted another problem in source code:cry:
 

ya i am unable to built up my source code..........
 

What is the error? and in what statement?
Please provide more details if you want to get help.
 
Thanks for d help
its coming as invalid source code durin compiling...
 

make sure your program is rite..if you cant compile..
post your code..someone will figure it out..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top