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.

Gsm sim300 serial read issue

Status
Not open for further replies.

ashokb

Newbie level 3
Newbie level 3
Joined
Jan 13, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
41
I am working on Sim300, trying to receive sms on atmega16 via serial communication. When i send
" *23# "
sms to gsm modem from my mobile, gsm sends
" \r\n+CMGR:\s"REC\sUNREAD","+919762148043",,"14/03/13,23:04:32+22"\r\n*23#\r\n\r\nOK\r\n "
as response on serial port. I am getting this data on atmega16, but only
" \r\n+CMGR:\s"REC\sUNREAD","+919762148043",,"14/03/13,23:04:32+22"\r "
this much of string where that
" *23#"
is my actual sms and i am expecting "23". my firmware looks like this,


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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('@');
}



Am expecting "+++r*23@" as output on lcd. I have checked, it receives '+' as well as '\r' but not '*' and further. Am stuck here, please help, what's going wrong.
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top