I am working on GSM sim300. I want to receive SMS on serial port of atmega16. When I send SMS " 23# "to gsm modem it send,
" \r\n+CMGR:\s"REC\sUNREAD","+919762148043",,"14/03/13,23:04:32+22"\r\n23#\r\n\r\nOK\r\n "
this string in response. I am parsing this string using this logic
while(Serial.available())
{
char tempChar = Serial.read();
if(tempChar == '+')
{
isPreSms = true;
lcd.print('+');
}
else if((tempChar == '\r') && (isPreSms == true))
{
isPreSms = false;
lcd.print('r');
}
else if(tempChar == '*')
{
digitalWrite(OKLed, HIGH);
isSms = true;
lcd.print('*');
}
else if((tempChar == '#') && (isSms == true))
{
digitalWrite(powerLed, HIGH);
isSms = false;
lcd.print(sms);
}
else if(isSms)
{
digitalWrite(alertLed, HIGH);
sms += tempChar;
}
}
lcd.print('@');
}
I am expecting " +++r*23@" on my lcd display, but am getting only this " +++r@".
It means controller receive
" \r\n+CMGR:\s"REC\sUNREAD","+919762148043",,"14/03/13,23:04:32+22"\r\n "
this much of string. I am got stuck here. GSM send complete string(i verified that) but controller not receiving complete. Please help.