Microcontroller based robot project

Thread Starter

jibinsabu

Joined Feb 18, 2016
7
Hi,
Please help me to solve the issue with my project..i am doing an rf controlled fire fighter robot using AT89S52 microcontroller..all the communications are good..decoder output is good..microcontroller input is ok..but the output have no response. I here upload the circuit and program
.please help me because it is very urgeng gor me.
Thanks
 

Attachments

JohnInTX

Joined Jun 26, 2012
4,787
Welcome to AAC!
To help us help you, please post your code in text using CODE tags (available from the toolbar). Also, post a schematic of your circuit.
What does 'output have no response' mean? Motors, spray or what?
How do you know that the RF is working and that communications are good?
Which compiler and debugger are you using?
 

GopherT

Joined Nov 23, 2012
8,009
@jibinsabu

In Rf_process()
Your "Move backward", you have a single & instead of && like the rest of your logical check

Also, we need a schematic to really help you because I cannot tell of a Pump=0 is turning the water on or off.
 
Last edited:

GopherT

Joined Nov 23, 2012
8,009
Please tell me a solution..i want to check whether the microcontroller is working.

This is too difficult.

You need to copy your code.
Paste it into a post here.
Type the phrase CODE inside of square brackets [ ] at the top of your code
Type the phrase [/CODE] at the bottom of your code

That way we can read the whole thing.

Then you need to tell us how you expect this to work with a short text. We cannot see anything about the RF, what exactly is not working, what is working.
What pins di what.
 

Thread Starter

jibinsabu

Joined Feb 18, 2016
7
C:
///////////NAVGATION MOTORS DEFINE/////////////
sbit M21=P2^0;
sbit M22=P2^1;

sbit M23=P2^2;
sbit M24=P2^3;

        ////////ARM MOTORS DEFINE/////////
sbit M11=P2^4;
sbit pump=P2^7;

sbit M13=P2^6;
sbit M14=P2^7;

        ///////////DATA LINE///////////
sbit D1=P1^0;
sbit D2=P1^1;
sbit D3=P1^2;
sbit D4=P1^3;
sbit VT=P1^4;


sbit mode_led=P0^1;    // mode indicating led
void rf_process2();
void armcontrole();


void Delay(int a)
{
    int j;
    int i;
    for(i=0;i<a;i++)
    {
        for(j=0;j<120;j++)
        {
        }
    }
}



  



void main()
{ 
P1=0XFF;
P2=0X00;
VT=1;
while(1)
    {
        rf_process2();  
        armcontrole();
    }
}
//////////////////////




void rf_process2()
{ mode_led=1;
    {


// move the robot forword
      
if(D1==1&&D2==1&&D3==1&&D4==0&&VT==1)
        {
            M21=1;
            M22=0;
            M23=1;
            M24=0;
            }

// move the robot backword
    else if(D1==1&&D2==1&D3==0&&D4==1&&VT==1)
        {
            M21=0;
            M22=1;
            M23=0;
            M24=1;  
        }

// move the robot right
    else if(D1==0&&D2==1&&D3==1&&D4==1&&VT==1)
        {
            M21=1;
            M22=0;
            M23=0;
            M24=0;
        }

// move the robot left
    else if(D1==1&&D2==0&&D3==1&&D4==1&&VT==1)
        {
            M21=0;
            M22=0;
            M23=1;
            M24=0;  
          }


///    else stop
    else
        {
            M21=0;
            M22=0;
            M23=0;
            M24=0;
            Delay(200);  
        }



}  
}


///// arm control mode

void armcontrole()
{

    if(D1==0 && D2==0 && D3==1 && D4==1 && VT==1)
        {
        while(D1==0&&D2==0&&D3==0&&D4==1&&VT==1);
        while(1)
        { mode_led=0;



//increase the angle of the arm
      
            if(D1==1&&D2==1&&D3==1&&D4==1&&VT==1)
            { 
             M13=1;
             M14=0;
            }

//decrease the angle of the arm

            else if(D1==1&&D2==1&&D3==1&&D4==1&&VT==1)
            {
             M13=0;
             M14=1
             }
//spray 'on'       
                  else if(D1==1&&D2==0&&D3==1&&D4==1&&VT==1)
            { pump=0;
            
            
                /////spray off
            }
            else if(D1==0&&D2==0&&D3==1&&D4==1&&VT==1)
            {
             while(D1==0&&D2==0&&D3==1&&D4==1&&VT==1);
            
            }
// stop
                else
                {
            M11=0;
            pump=1;
            M13=0;
            M14=0; 
            Delay(200);  
        }
      
         }
        }
}





This is the program.

Thanks.

This is rf controlled fire fighter robot..we used at89s52 microcontroller..

MOD note: Added CODE-tags.
 
Last edited by a moderator:

GopherT

Joined Nov 23, 2012
8,009
Line 79 above, you are still missing an &
else if(D1==1&&D2==1&D3==0&&D4==1&&VT==1)

it should probably be...
else if(D1==1&&D2==1&&D3==0&&D4==1&&VT==1)


Also, are you sure you want the
While(1)
in line 130 above? What situation will you need it to get caught in that loop forever?
 

Thread Starter

jibinsabu

Joined Feb 18, 2016
7
Sir,
These are the critical days of my life that i have only 1 week to submit my project.
I am doing a project on rf controlled fire fighter robot using 8051.
But i can't make a good program for my project.
I will breifly explain my project.
My project have 2 motors for wheels
And 1 more motor for controlling the robotic arm.
Robotic arm is supplied with a pump which can pump water.

The control is using a remote which consists of 4 push buttons.

So,
There is 2 modes: robot navigation mode and arm control mode.

The transmission is done through rf modules with ht12e and ht12d ics.The rf communication is working.ok

I will tell the operation,
Robot navigation mode,
D4 pushbutton press : robot forward
D3 : robot backward
D1 : robot right
D2 : robot left

Arm conrol mode.
There is an led indication for this mode.
Press D1 and D2 together to switch to this mode.at this time the led must glow.
(but i dont know the program for return back to navigation mode by pressing the same buttons together.please)

Then, in this mode,
D4 : increase arm angle
D3: decrease arm angle
D2: spray/pump on

This is the only requirments.

I made a program with this requirements , but i am not sure about its accuracy. I am only a begginer of programming.i here include my program and image of proposed project.

Please tell me if there any errors/ modifications.thanka lot.
C:
[LIST=1]
[*]#include<AT89x52.h>
[*]///////////NAVGATION MOTORS DEFINE/////////////
[*]sbit M21=P2^0;
[*]sbit M22=P2^1;
[*]

[*]sbit M23=P2^2;
[*]sbit M24=P2^3;
[*]

[*]       ////////ARM MOTORS DEFINE/////////
[*]sbit M11=P2^4;
[*]sbit pump=P2^5;
[*]

[*]sbit M13=P2^6;
[*]sbit M14=P2^7;
[*]

[*]       ///////////DATA LINE///////////
[*]sbit D1=P1^0;
[*]sbit D2=P1^1;
[*]sbit D3=P1^2;
[*]sbit D4=P1^3;
[*]sbit VT=P1^4;
[*]

[*]

[*]sbit mode_led=P0^1;   // mode indicating led
[*]void rf_process2();
[*]void armcontrole();
[*]

[*]

[*]void Delay(int a)
[*]{
[*]   int j;
[*]   int i;
[*]   for(i=0;i<a;i++)
[*]   {
[*]       for(j=0;j<120;j++)
[*]       {
[*]       }
[*]   }
[*]}


[*]void main()
[*]{
[*]P1=0XFF;
[*]P2=0X00;
[*]VT=1;
[*]while(1)
[*]   {
[*]        rf_process2();
[*]        armcontrole();
[*]   }
[*]}
[*]//////////////////////

[*]void rf_process2()
[*]{
[*]mode_led=0;
[*]   {
[*]

[*]

[*]// move the robot forword
[*] 
[*]if(D1==1&&D2==1&&D3==1&&D4==0&&VT==1)
[*]       {
[*]            M21=1;
[*]            M22=0;
[*]            M23=1;
[*]            M24=0;
[*]           }
[*]

[*]// move the robot backword
[*]   else if(D1==1&&D2==1&&D3==0&&D4==1&&VT==1)
[*]       {
[*]            M21=0;
[*]            M22=1;
[*]            M23=0;
[*]            M24=1;
[*]       }
[*]

[*]// move the robot right
[*]   else if(D1==0&&D2==1&&D3==1&&D4==1&&VT==1)
[*]       {
[*]            M21=1;
[*]            M22=0;
[*]            M23=0;
[*]            M24=0;
[*]       }
[*]

[*]// move the robot left
[*]   else if(D1==1&&D2==0&&D3==1&&D4==1&&VT==1)
[*]       {
[*]            M21=0;
[*]            M22=0;
[*]            M23=1;
[*]            M24=0;
[*]         }
[*]

[*]

[*]///    else stop
[*]   else
[*]       {
[*]            M21=0;
[*]            M22=0;
[*]            M23=0;
[*]            M24=0;
[*]            Delay(200);
[*]       }


[*]}
[*]}

[*]///// arm control mode
[*]

[*]void armcontrole()
[*]{
[*]

[*]   if(D1==0 && D2==0 && D3==1 && D4==1 && VT==1)
[*]       {
[*]       while(D1==0&&D2==0&&D3==0&&D4==1&&VT==1); // i want to change back to rf_process2 mode here i dont know
[*]       while(1)
[*]         }
[*]       {
[*]mode_led=1;


[*]//increase the angle of the arm
[*] 
[*]           if(D1==1&&D2==1&&D3==1&&D4==0&&VT==1)
[*]           {
[*]             M13=1;
[*]             M14=0;
[*]           }
[*]

[*]//decrease the angle of the arm
[*]

[*]           else if(D1==1&&D2==1&&D3==0&&D4==1&&VT==1)
[*]           {
[*]             M13=0;
[*]             M14=1
[*]             }
[*]//spray 'on'  
[*]                 else if(D1==1&&D2==0&&D3==1&&D4==1&&VT==1)
[*]           {
[*]pump=1;
[*]   }    
[*]       
[*]           
[*]// stop
[*]               else
[*]               {
[*]            M11=0;
[*]            pump=1;
[*]            M13=0;
[*]            M14=0;
[*]            Delay(200);
[*]       }
[*] 
[*]         }
[*]       }
[*]}
[/LIST]
This is the program.

Thanks.

Mod edit: added code tags. Moved new thread to here - please do not start more than one thread on the same topic.
 

Attachments

Last edited by a moderator:

JohnInTX

Joined Jun 26, 2012
4,787
You still haven't told us what it is and is not doing that it should be doing. One thing to do for sure is reorder your tests with parenthesis i.e.

if(D1==1&&D2==1&&D3==1&&D4==0&&VT==1)
Should be
if ( (D1==1) && (D2==1) && (D3==1) && (D4==0) && (VT==1) )

&& has a higher order of precedence than ==. Your test evaluates 1&&D2 instead of testing D2==1 and so on. Not what you want.
 
Last edited:

JohnInTX

Joined Jun 26, 2012
4,787
Then, is there any corrections? Does this work?
I don't know. According to Google you are 9444 miles closer to your workbench than I am. The best advice I can give you is to fix up all of those test statements and try it. If it still does not work, break the code into one single small section and get that working then use what you learn from that to apply to the rest of the functions. We can not give you a canned solution based on the info you have provided and likely wouldn't in any case because this is your project. If this is to move to completion, it will be up to you to do it.

Good luck
 
Top