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 / read and comapare message in ATmega16

read and comapare message in ATmega16

|

Microcontroller › AVR › read and comapare message in ATmega16

  • This topic has 4 replies, 2 voices, and was last updated 12 years, 8 months ago by Sagar.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 27, 2013 at 12:17 pm #2446
    Shashank Rao.C
    Participant

    how to read and compare a message recived in gsm module? can any one give me a sample program?

    May 27, 2013 at 1:50 pm #9834
    Sagar
    Participant

    i don’t have a program for atmega16. actually i wrote one for RD2 uC and it worked great for me.  the logic remains same.

    set up usart (check atmeg16 usart tutorial) with 9600 baud rate.

    write serial send and serial receive function.

    the next thing is to set your modem in text mode format.

    the command to do so is AT+CMGF=1

    now whenever a new sms is received u’ll recv this string

    +CMTI: “SM”,1

    where SM indicates sim card and 1 is the memory location.

    you have to collect these bytes in charecter array one by one.

    then to read sms send this command AT+CMGR=1

    after executing this command you will get your sms charecters 1 by 1.

    study the message format in some terminals (like senders no and newline blah blah). i used putty. extract the string and then write/use function strcmp function.

    Hope you are good at writing c codes. check out ur modem datasheet.

    all the best.

    May 28, 2013 at 4:07 am #9843
    Shashank Rao.C
    Participant

    thank you sagar bhai….

     actually I am a beginner in C.

    May 28, 2013 at 6:32 am #9848
    Shashank Rao.C
    Participant

    how does the mcu will know that msg string is going to end? is the last bit of recived string is a null char ()?

    please tell me….

    if there is a sample prog for atmega16 it will be a great helpfull for me.

    May 28, 2013 at 9:10 pm #9851
    Sagar
    Participant

    no you won’t find null character at the end.

    if u study the formatted data you are receiving from gsm modem u will find that for every command executed successfully, the last few data bytes are OKrn and for those having errors like say i am reading message from sim memory location 1 and message does not exist there

    AT+CMGR=1
    +CMS ERROR: 517rn

     

    thats what you have to wait for (OKrn or error messages depending on AT commands u used).

    you may need to manually put the null character for string comparision. (depends on your programming)

     

    :-) Happy Programming

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

RSS Recent Posts

  • FM Radio circuits February 7, 2026
  • wall transformer polarity February 7, 2026
  • To buy or DIY? February 7, 2026
  • engineering analysis of shmidth trigger without simulation February 6, 2026
  • ANOTHER OLD PROJECT REDO February 6, 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