Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SIM900A reading message from AT+CMGR command

Status
Not open for further replies.

hithesh123

Full Member level 6
Joined
Nov 21, 2009
Messages
324
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
lax
Activity points
3,548
How to read received SMS.
When I use AT+CMGR=1, I get a lot of details. How to filter out this and read just the message?
 

Every AT handling firmware needs a kind of response parser, looking for keywords and respective field delimiters e.g. commas. Now you're going to write it. Or try to find some working code written by others.

Happy developing!
 

If you have lot of RAM say 600 bytes or more then set 300 bytes for uart buffer. Max length of SMS is 160 bytes without header. Header will be 80 to 90 bytes. So it wont exceed 300 bytes. read all bytes into buffer and then parse the buffer. This won't work fine when PIC16F devices are used because of bank switching problem. I use 18F devices for GSM projects.
 

can you please share your code. ????

- - - Updated - - -

void setup()
{
Serial.begin(9600);
Serial.write("AT+CMGF=1\r"); //set GSM to text mode
delay(1500);
Serial.write("AT+CPMS=\"SM\"\r"); //Preferred SMS Message //Storage
delay(1000);
Serial.write("AT+CMGR=1\r");
Serial.write("AT+CNMI=2,2,0,0,0\r");
delay(1000); //list the first message from SIM //Memory
while(1)
{
if(Serial.available())
{
Serial.write(Serial.read());
}
}
}
void loop()
{
}

im.png
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top