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 / Topics / reading sms from gsm modem and comparing with predefind one

reading sms from gsm modem and comparing with predefind one

|

Microcontroller › PIC › reading sms from gsm modem and comparing with predefind one

  • This topic has 23 replies, 7 voices, and was last updated 8 years, 9 months ago by narasimha rao.
Viewing 15 posts - 1 through 15 (of 24 total)
1 2 →
  • Author
    Posts
  • July 24, 2012 at 4:34 am #1889
    td
    Participant

    hi,

    in our project, we are using pic 18f and modem sim 300.and we are using c18 compiler.in that i have written program for sending and receiving sms through gsm modem.when i use the AT command for reading sms, i m getting like this

     

    AT+CMGR=1
    +CMGR: “REC READ”,”+918108111649″,,”12/07/22,14:24:11+22″
    Hello

    OK

     

    here i have to read the sms “Hello”, which comes before “OK”.and compare it with a predefined string. i write for parsing string.but i m not getting the word “Hello”. here is codes…

     

    <code>

    putrsUSART(“ATnr”);
    putrsUSART(“AT+CMGF=1”);
    putcUSART(0x0D);
    Delay10KTCYx(500);
    putrsUSART(“AT+CMGR=1”);
    putcUSART(0x0D);
    Delay10KTCYx(500);

     if(PIR1bits.RCIF)  
    {
    for(i=0;i<5;i++)

        a=getcUSART();

    }
    putsUSART(a);
     

    </code>

    while exicuting this, i m getting “a ” as some srange characters like ?2k> or ?ï2oÈ

    how can i extract the messange hello?? please help me to solve this problem.

    thank you

    July 24, 2012 at 9:20 am #8320
    Manikandan
    Participant

    Hi,

       I think delay may be the problem. please check and correct the delay.

    Thank you,

    Manikandan A

    July 25, 2012 at 4:20 am #8325
    td
    Participant

    Thank you for reply.

     

    i have reduced the delay .and took the buffer like a[50],

    in both case stange characters are coming.

    July 25, 2012 at 11:10 am #8327
    td
    Participant

    thanks for reply..

     

    what you mean by

    if(Rcv_Byte==arr1[count]||count>5)

     

    is that necessary to set flag??

    July 25, 2012 at 2:02 pm #8329
    td
    Participant

    thank you 

     

    here your program is for getting hello only..but the modem response is 

     

    +CMGR: “REC READ”,”+918108111649″,,”12/07/22,14:24:11+22″
    Hello

    OK

    so 1st we have to read these whole string.how can i read this whole sting?

    i used some inbuilt functions for reading charecter wise.but some strange characters are coming.here is my code.

     

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

        a=getcUSART();

    }
    putsUSART(a);

    how can i input that whole sting to pic?

     

     

     

    July 29, 2012 at 10:40 am #8360
    td
    Participant

    i changed the steps, but i m not getting the string…

    +CMGR: “REC READ”,”+918108111649″,,”12/07/22,14:24:11+22″
    Hello

    OK

     

    here is the pgm……

     

    putrsUSART(“AT+CMGR=1”);
    putcUSART(0x0D);

    while(BusyUSART());
    gets(a);
    Delay1KTCYx(75);
    putsUSART(a);

    }

     

    void gets(char *buffer)
    {
      unsigned char data;
     do
      {
        while(!DataRdyUSART());// Wait for data to be received
        data = getcUSART();                         
        *buffer = data;
        buffer++;              // Increment the string pointer
      }
    while(data!=’K’);
    *buffer=’’;
    }

     

    please help me to print the modem response….

     

    thank you

    July 31, 2012 at 10:56 am #8374
    td
    Participant

    when i connected pic and levelconverter to pc, the above program is working fine.but, when i connected modem and pic, i can send sms.and modem can read the sms.but when the modem execute the AM+CMGR=1 command, the modem response string is not going to pic. please help me to solve the problem..

    August 2, 2012 at 8:57 am #8383
    Amrith
    Participant

    Hi td,

    Correct your command mentioned AM+CMGR=1 as AT+CMGR = 1,

    August 2, 2012 at 10:37 am #8385
    td
    Participant

    in my program, i have written like this

    AT+CMGR = 1

    when i re-write in last post, AT changes to AM. sorry for the mistske.

     

    please give me one solution to my problem.how can i give modem response to pic?

    August 2, 2012 at 11:40 am #8386
    Amrith
    Participant

    Hi,

    As you send command AT+CMGR =1 to GSM modem, you will receive the message data. you might not capturing the data properly in the buffer. Avoid delay functions in between this communication.

     

    Important Note: Take care that you are connecting Tx pin of GSM module to Rx pin of DB9 serial cable & Rx pin of GSM module to Tx pin of DB9 serialcable.

     

    August 2, 2012 at 11:56 am #8387
    td
    Participant

    i m not giving the delay aftr AT+CMGR=1

     

     

    putrsUSART(“AT+CMGR=1”);
    putcUSART(0x0D);

    while(BusyUSART());
    gets(a);

     

     

    and i connected modem and pic directly- rx of pic to tx of modem and vice verse. but then also nothing is going to tic.ie, response of modem is not going to pic

    August 2, 2012 at 12:03 pm #8388
    Amrith
    Participant

    Hey,

    You must use level converter between your PIC & GSM modem, better share your schematics to verify how you are connecting..

    August 4, 2012 at 6:35 am #8395
    td
    Participant

    thank for reply..

    my pic is working at 3.3v and modem at 4v.so why should i use level converter? i connected rx,tx pin of modem to tx,rx pin of pic.

    and connected level converter(max232) parallel to pic(used only for watching in hyper)

     

    i can send sms from modem to mobile.and modem can read the sms..but the response of the modem is not going to pic

     

     

    August 5, 2012 at 9:16 am #8398
    td
    Participant

    hi

     

    in this project pic is not getting the response from modem.

    i just write the AT command, then modem is responding OK.but pic is not getting that response.i tried to print the response from modem.but i m not getting any output.

    when i checked pic and hyper, its working and checked modem and hyper.that is also working. ang when i connected pic and gsm modem, modem is getting all the commands from controller.and i can send sms from modem to mobile.but in case of sms reading, modem is responding for AT+CMGR=1.

    but pic is not getting that response.ie,from pic to gsm, transmission is ok.but from gsm to pic, not working.

     

    please help me to sove this problem

    August 6, 2012 at 6:40 am #8404
    Amrith
    Participant

    you need a level converter between PIC & GSM modem because the GSM modem has a level converter inside which converts ttl to rs232 level, so you should not connect GSM modem directly to controller, you got to use level converter to convert these rs232 levels to ttl levels again.

     

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 24 total)
1 2 →
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • IoT: Transforming Businesses with Digital Engineering June 23, 2025
  • PIC KIT 3 not able to program dsPIC June 23, 2025
  • Fun with AI and swordfish basic June 23, 2025
  • Is AI making embedded software developers more productive? June 23, 2025
  • Microinverters and storeage batteries? June 22, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 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