Hi
Featured Services
Tutorials on Embedded
System Design .
Tutorials on
Antenna Design.
Tutorials on
Image Processing Using
Open-CV.
read more

Search in Google below

Google Custom Search Engine

PROJECTS WITH CODE

HELP SHARE IDEAS.COM
Mail us at : info@helpshareideas.com

:Uploaded on Tuesday 10th NOV 2020

Code for the Implemenatation of Project :
Mobile Controlled DTMF & ARM 7 Based Robot for Multi-Application

The main principle of this project is controlling and monitoring the Robot using a DTMF decoder. Here we are using the basic mobile phone which will be connected to DTMF decoder which will decode the signal received. The microcontroller receives the data then interpretes the same and controls the Robot movement with the aid of signals received from sensors.

Code for the Implementation of the Project

Code :

    #include #include

    // void UART0_Init( );
    // void uart1_init(void) ;
    void Device_Init( void );
    void MSDelay( unsigned int Milli_Sec );
    void Forward_L_R( void );
    void Rotate_L( void );
    void Rotate_R( void );
    void Reverse_L_R( void );
    void robo_stop(void) ;
    void Forward_test( void );
    void Rotate_Left_test( void );
    void Rotate_Right_test( void );
    void Backward_test( void );
    void robo_stop_test(void) ;

    int main (void)
    {
    unsigned char i;
    // lcd_msg1();
    // uart1_init();
    Device_Init( );
    MSDelay(150000); // waiting for 150 secs
    // ******* Testing Robot *********
    Forward_test( );
    // MSDelay(20);
    Rotate_Left_test( );
    // MSDelay(20);

    Rotate_Right_test( );
    // MSDelay(20);
    Backward_test( );
    robo_stop_test( );
    MSDelay( 60000 ); // Testing & waiting for 60secs.
    // *******************************
    while(1)
    {
    int din ;
    din= IO0PIN & 0x000F ; // checking status of P0.0 to P0.3 input Pins
    switch (din)
    {
    case 0x02:
    {
    Forward_L_R( );
    break;
    }
    case 0x07:
    {
    Forward_L_R( );
    break;
    }
    case 0x09:
    {
    Rotate_L( );
    break;
    }
    case 0x04:
    {
    Rotate_L( );
    break;
    }
    case 0x06:
    {
    Rotate_R( );
    break;
    }
    case 0x0C: // value for #
    {
    Rotate_R( );
    break;
    }
    case 0x08:
    {
    Reverse_L_R( );
    break;
    }
    case 0x05:
    {
    robo_stop( );
    break;
    }
    case 0x0A: // for value of 0
    {
    robo_stop( );
    break;
    }
    case 0x0B: // for *
    {
    robo_stop( );
    break;
    }
    } // end of switch
    } // end of while
    } // end of main

    void Device_Init( void )
    {
    // P0.16-23 --> used for 6 motors control
    // P0.4 --> GLCD RS
    // P0.5 --> GLCD Enable
    // P0.6 --> GLCD CS1
    // P0.7 --> GLCD CS2

    // IODIR1 = 0x00FF0000;
    // IODIR0 = 0x00031C00;
    // Setting P0.0 to P0.3 as Input Pins by giving 0 in IODIR0
    IODIR0 = 0x00FF00F0;
    // UART0_Init( );
    // UART1_Init( );
    // 3 is set to assign port pin for ADC3 (P0.10)
    // 5 is used to assign port pins for UART0 (P0.0 & P0.1 as Tx & Rx) but here I am using P0.0 to P0.3 as IO Pins hence made its set as 0
    PINSEL0=0x00350000;
    PINSEL1=0x00030000; // Assign Port pin for ADC2 (P0.24) & Select P0.16 to P0.23 for IO Pins.
    }
    void Forward_L_R(void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00050000; // Pin P0.18 & P0.16 are high
    MSDelay(1500);
    IOCLR0 = 0x000F0000;
    MSDelay(100);
    }
    void Rotate_L( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00060000; // Making Pin P0.17 & P0.18 high
    MSDelay (1200);
    IOCLR0 = 0x000F0000;
    MSDelay (100);
    }
    void Rotate_R( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00090000; // P0.17 & P0.19 are made high
    MSDelay(1000);
    IOCLR0 = 0x000F0000;
    MSDelay(100);
    }

    void Reverse_L_R ( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x000A0000; // Pin P0.19 & P0.17 are made high
    MSDelay(1200);
    IOCLR0 = 0x000F0000;
    MSDelay(100);
    }
    void robo_stop ( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00000000; // Pin P0.19 P0.18 & P0.17 P0.16 are made low
    MSDelay(1000);
    IOCLR0 = 0x000F0000;
    MSDelay(100);
    }

    void MSDelay( unsigned int Milli_Sec )
    {
    unsigned int x,y;
    for(x=0;x {
    for(y=0; y<250; y++)
    {
    }
    }
    }

    void Forward_test(void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00050000; // Pin P0.18 & P0.16 are high
    MSDelay(150000);
    IOCLR0 = 0x000F0000;
    MSDelay(1000);
    }
    void Rotate_Left_test( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00060000; // Making Pin P0.17 & P0.18 high
    MSDelay (100000);
    IOCLR0 = 0x000F0000;
    MSDelay (1000);
    }

    void Rotate_Right_test( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00090000; // P0.17 & P0.19 are made high
    MSDelay(100000);
    IOCLR0 = 0x000F0000;
    MSDelay(1000);
    }

    void Backward_test( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x000A0000; // Pin P0.19 & P0.17 are made high
    MSDelay(100000);
    IOCLR0 = 0x000F0000;
    MSDelay(1000);
    }

    void robo_stop_test( void )
    {
    IOCLR0 = 0x000F0000;
    IOSET0 = 0x00000000; // Pin P0.20 P0.19 P0.18 & P0.17 are made low
    MSDelay(30000);
    IOCLR0 = 0x000F0000;
    MSDelay(1000);
    }

Kindly mail us if you get any difficulties while testing this code.
Note : We will soon update Tutorials page. You Can Learn how to create a Project using Arm 7 - LPC 2148 using these demos. Hence Kindly visit the page for more updates

Editor: HelpShareIdeas.com

For giving feedback on this article please mail us at : info@helpshareideas.com

<: Click the link PROJECTS with Code to access the Latest Projects with codes Page:>