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.

[51] Need help in programming for my robot using embedded C

Status
Not open for further replies.

elphine

Newbie level 5
Newbie level 5
Joined
Sep 2, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
MUMBAI
Activity points
67
Hello guys....their is problem with the programming...so i need help in this. the code i have written is pasted below. this program is for the project accelerometer based hand gesture controlled robot.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<reg52.h>
int i;
void main(void)
{
P0=0xFF; /*initialise P0 as input for sensor*/
for (i=0;i<10000;i++)
while(1)
{
switch(P0) /*check status of port P0*/
{
case (0xF5):
    P3=0xFA; /*forward*/
    for(i=0;i<30000;i++)
    break;
 
case (0xFA):
    P3=0xF5;/*reverse*/
    for(i=0;i<30000;i++)
    break;
 
case (0xF6):
    P3=0xF8;/*right*/
    for(i=0;i<30000;i++)
    break;
 
case (0XF9):
    P3=0xF2;/*left*/
    for(i=0;i<30000;i++)
    break;
}
}
}





please help....it is urgent.
 
Last edited by a moderator:

If those 'for' loops are meant to be delay loops they need a semicolon after each one.

for(i=0;i<30000;i++);

Right now you are breaking out of the switch statement on the first time through, and not executing the loops.

It would be helpful if you would provide slightly more context for your project. I am having to assume a number of things, not to mention you haven't actually told us what is not working.
 
i am trying to write program...which can do tasks..like taking input from port 0(4 bit) and accordingly send 4 bit data on the port3 to the motors(2 motors). sensor used is adxl 335.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top