EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home

Shahid nawaz malik

  • Profile
  • Topics Started
  • Replies Created
  • Engagements

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • August 16, 2012 at 7:34 am in reply to: vehicle tracking system using gsm and gps module #8472
    Shahid nawaz malik
    Participant

    guys…my project is same as of u with some additions…means i hav to lock/unlock door and ignition on/off…….i hav a lil bit idea about pic programing …kindly plzz help me in code i hav a code and and am able to understand some portion of code…code is given bellow

     

     

     

     

    EMBEDDED C SOURCE CODE:

    #include <16F877A.h>

    #include <gsm.c>

    #include <gps.c>

     

    #use        delay  (clock=20M) //Crystal Oscillator speed 20MHz

    #use        rs232  (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM) //For GSM Modem

    #use        rs232  (baud = 4800, xmit=PIN_A1,rcv=PIN_A0,stream=GPS) //For GPS Receiver

    byte ch = 0;

    int count = 0;

    byte data[150]; //For SMS storage

    byte wru[] = { “wru” };

    byte about[] = {“about”};

    byte help[] = {“help”};

    byte lock[] = {“lock”};

    byte unlock[] = {“unlock”};

    byte num[12];   //for storing phone number

    char lat[12];   //for storing latitude

    char lngtd[12]; //for storing lngtd

    char speed[12]; //for storing speed

    char tdata[12]; //for temprary data

    void main()

    {

       int i = 0;

       int j = 0;

       int flag = 0;

       output_high(PIN_D1);        // send “1” to pinD1

       delay_ms(1000);

       output_low(PIN_D1);

       delay_ms(1000);

       output_high(PIN_D1);

       delay_ms(1000);

       output_low(PIN_D1);

          init_phone();

          while(1)

       {

         output_toggle(PIN_D1);  //GSM Indicator LED

         delay_ms(500);

         count = 0;   //reset data buffer    

         data[count] = 0;                 //data[ ] is for sms storage

        

                            if(!input(PIN_C4)) //Accident Sensor switch.

            {

                //Crash Message Handling

                output_high(PIN_D0); //LED Indicator

                get_GPS_data(lat,lngtd);  //Read GPS data for lat and lngtd

                fprintf(GSM,”AT+CMGS=”%s”rn”,mynum); //Send SMS message to pre-defined number

                fprintf(GSM,”ALERT: Vehicle No.9999 Crashed at Latitude: %s Longitude: %s rn”,lat,lngtd); //Send SMS data

                fputc(0x1A,GSM);  //^Z to send sms

                output_low(PIN_D0);  //LED Indicator

                continue;

            }

         }

         fgets(data,GSM); //Read sms data into data buffer

     

         if(strlen(data) < 14)  //No message in string. returns OK or ERROR. Depends on Modem type

         {     

           continue;

         }

         //Delete the message

         fprintf(GSM,”AT+CMGD=1rn”);  //delete message from SIM card

         delay_ms(2000);       

     

         //Read the available message content

          //extract the phone number from SMS Message

     

          get_phone_number(data,num);  //extract phone number into num variable

         if(strstr(data,wru)) //If the message contains “wru”

         {           

             get_GPS_data(lat,lngtd);

     

             output_high(PIN_D1);

            

             fprintf(GSM,”AT+CMGS=”%s”rn”,num);

             fprintf(GSM,”Hello, I am located at “);

             fprintf(GSM,”Latitude: %s  Longitude: %s “,lat,lngtd);

             fprintf(GSM,”Speed: %s kmph. “,speed);

             fprintf(GSM,”Please use Google Earth to see my location.rn”);        

             fputc(0x1A,GSM);

         }

         else if(strstr(data,about)) //If the message contains “about”

         {        

             output_high(PIN_D1);

             fprintf(GSM,”AT+CMGS=”%s”rn”,num);

             fprintf(GSM,”B.Tech Final Year(2009-2010) Project rn”);

             fprintf(GSM,”GPS & GSM Based Vehicle Theft Control System. rn”);

             fprintf(GSM,”Engineering Final Year Project.rn”);        

             fputc(0x1A,GSM);                 

         }

         else if(strstr(data,unlock))

         {

             output_high(PIN_D1);

             output_low(PIN_D7);

             fprintf(GSM,”AT+CMGS=”%s”rn”,num);

             fprintf(GSM,”Vehicle got unlocked”);

             fputc(0x1A,GSM);        

         }

         else if(strstr(data,lock))

         {           

             get_GPS_data(lat,lngtd);

             output_high(PIN_D1);

             output_high(PIN_D7);

             fprintf(GSM,”AT+CMGS=”%s”rn”,num);

             fprintf(GSM,”Vehicle got locked out at location  “);

             fprintf(GSM,”Latitude: %s  Longitude: %s “,lat,lngtd);

             fprintf(GSM,”Please use Google Earth to see my location.rn”);

             fputc(0x1A,GSM); //^Z

         }

         else if(strstr(data,help))

         {        

             output_high(PIN_D1);

             fprintf(GSM,”AT+CMGS=”%s”rn”,num);

    fprintf(GSM,”Send “wru” to get my location rn”);

             fprintf(GSM,”Send “about” to know about mern”);

             fprintf(GSM,”Send “lock” to Lock the Vehicle Ignition.rn”);

             fprintf(GSM,”Send “unlock” to Unlock.rn”);

             fputc(0x1A,GSM);

         }    

      }

    }

     

  • Author
    Posts
Viewing 1 post (of 1 total)

RSS Recent Posts

  • Projector focus circuit May 18, 2026
  • Relay question May 18, 2026
  • Phone Charger 5v to 12v May 17, 2026
  • reviving old swordfish program but? May 17, 2026
  • Assistance locating a 'trail' camera gadget, please ? May 16, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise