Read SMS message
Mikael S
Posts: 60
Hello,
I have Wavecom GSM/GPRS modem connected via MAX2323E to my propeller. I Have no problem to send sms with AT commands, but i can't figure out how to recieve a sms message.
I use this code to send:
Is there anyone who can help me with a tip how i can recieve a message and for example show it in the Serial Terminal.
Grateful for any help!
/Mikael
I have Wavecom GSM/GPRS modem connected via MAX2323E to my propeller. I Have no problem to send sms with AT commands, but i can't figure out how to recieve a sms message.
I use this code to send:
{{Mickes GSM 1.0}} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 obj gsm: "FullDuplexSerial" debug: "Parallax Serial Terminal" var long stack[90] pub main debug.start (115200) gsm.start (26, 27, 0, 9600) waitcnt (clkfreq * 2 + cnt) gsm.str (string("AT+CMGS=")) 'send sms command gsm.tx(34) ' send a " gsm.str (string("+46708667705")) 'phonenumber gsm.tx(34) gsm.tx(13) ' CR waitcnt (clkfreq * 2 + cnt) gsm.str (string("Hello World!!")) waitcnt (clkfreq * 2 + cnt) gsm.tx(26) 'ctr-z to send message debug.str(string("Klar!"))
Is there anyone who can help me with a tip how i can recieve a message and for example show it in the Serial Terminal.
Grateful for any help!
/Mikael
Comments
The string to read an SMS in a memory slot N (N is an integer!!) is:
AT+CMGR=N
To have a list of all the stored SMS use:
AT+CMGL="ALL"
Let me know if it works.
Massimo
AT command Meaning
+CNMI New message indications
+CMGL List messages
+CMGR Read messages
+CNMA New message acknowledgement
Below shows a simple example
AT
OK
AT+CMGF=1
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32" Hello, welcome to our SMS tutorial.
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32" A simple demo of SMS text messaging.
OK
AT+CMGR=2
+CMGR: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32" A simple demo of SMS text messaging.
OK
OK
I forget to tell, i'm a newbee....!
I have the AT commands, but i can´t figure out how to read the serial string from the modem...
I suspect you can do the same on the Wavecom
Is there any "trick" with the wiring of the max3232 that can go wrong? I have just wired the tx and rx directly to the prop pins, is that ok?
Thanks!
/Micke
There are a couple of traps. With the Telit modules you connect TXD of the modem to TX on the prop, and RXD to RX. This is slightly counter-intuitive as often one would connect TX and RX, and RX to TX. I'm not sure if Wavecom is the same or not - which exact module are you using?
If connecting directly to the prop you need to check the compatibility of the logic levels. Telits have 2.8v logic and a small resistor helps protect too much current from flowing. Or there are proper level shifting ICs if you want to do the job properly.
I'll PM you code I know works with the Telit in case its helpful
cheers
tubular
I will test the code as soon as possible ( have to work first...!)
The modem is a wavecom fastrack M1203. I think it uses TTL because i have -5v on one of the tx or rx pins when it is not connected.
/Micke
It sounds like you may be having some connection/hardware issues. Once those are resolved if you have further questions you might find some useful information in this thread or in some of the links therein.
http://forums.parallax.com/showthread.php?129927-Help-parsing-SMS
pb
But, to my next problem, i use the Extended FD_Serial obj to recieve the serial strings. Is it possible to extend the recieved bytes from 16 to 25?
I Have read on the forum thats its possible, but i cant figure out how, is there any example that i have missed?
Thanks!
/Mikael
Now i am stucked in next problem. When i try to use STRCOMP to parse the message from the modem with a string, i get no luck.
The code works fine until it get to the strcomp section, it just wont send it to the right PUB.