PDA

View Full Version : Help me To read Last recieved sms from hyper terminal



cool_guy4ever15
- 9th April 2009, 16:24
Hello every body

i'm new to this forum am working on sms remote control project.

i'm using t290i Ericsson.i am having a problem that when i send messege to the mobile and write at+cmgr=1 it doesn't read it i must convert the storing memory to me so i can read it so i write at+cpms="me" i can read the sms normally.so the first thing can any one tell me how to save this setting i want when any message recieved go to ME Memory no need to write at+CPMS="me"

the second problem is that whe i send a message and read it from hyperterminal by writing at+cmgr=1

i read the first message when i send another sms and i write at+cmgr=1 it doesn't read the last recieved SMS i read the old one while when i press at+cmgr=3 i read the last recieved.

now i want to read the last recieved message when i write at+cmgr=1.

here is a pic of my work:

http://img179.imageshack.us/img179/69/50483556.jpg

plz i need help as soon as possible

aratti
- 9th April 2009, 22:26
first thing can any one tell me how to save this setting i want when any message recieved go to ME Memory no need to write at+CPMS="me"

You need to select the memory area only once, then till the phone is on it will remain with that setting. Once you switch it off then you need to reset it.


i read the first message when i send another sms and i write at+cmgr=1 it doesn't read the last recieved SMS i read the old one while when i press at+cmgr=3 i read the last recieved.

If you want to read only the last sms then delate the message once you have read it. the command for deleting the first memory location is AT+CMGD=1

Al.

cool_guy4ever15
- 10th April 2009, 01:42
thanks Mr. aratti i really approtiate your fast replay.

i got that i must delete the old message so that when i write at+cmgr=1 read the last recieved.but here there is a problem is that the mobile will be connected to devices so when i send sms it switch the device on what if i want to switch the device off after few hours so i'll send a new sms sot the mobile won't read it because the mobile won't read the last recieved sms.

i wish you could understand me. and i wish u can tell me how can i deal with this problem.

aratti
- 10th April 2009, 08:41
If I understand you correctly, you want to switch on and off something using sms. If this is the case then you should delate all the sms from the phone used for this purpose.

A) I suggest you to use memory location "MT" instead of "ME"

Command : AT+CPMS=MT

B) list all sms contained in MT memory location with:

Command : AT+CMGL=0 - "list all received unread"
AT+CMGL=1 - "list all received read"
AT+CMGL=2 - "list all stored unsent"
AT+CMGL=3 - "list all stored sent"
AT+CMGL=4 - "list all sms present"

C) Delete all the MT memory location with:

Command : AT+CMGD=X " where X= sms number"

D) when phone memory location is clean than check the presence of new sms with :

Command AT^SMGR=1

phone answer will be different if sms is present or not, so act in function of the answer obtained. If not sms present delay for as long as you like and then read location again and so on.
If sms is present then decode it. Do the action required and then delete the sms with:

Command : AT+CMGD=1

and return enquiring for the presence of new sms.

Hope it will help.

Al.

cool_guy4ever15
- 11th April 2009, 01:24
yes you understand me that i want to connect the mobile to MCU and the MCU with devices which i can switch it on or off by just sending sms.

a) when i tried to use memory location MT and i write AT+CPMS="MT" it gives me an error and i tried it without " " it also gives me an error but i think that You Mean "SM" But I couldn't read any thing it gives me error:http://img23.imageshack.us/img23/573/39185371.png

b) Here is a list of the memory location "SM"
http://img23.imageshack.us/img23/5890/18066054.jpg
u can see in the picture that i have send a message and it takes priority no.6 while it is the last recieved. u r telling me that i must delete all messages so when i write AT+CMGR=1 i read the last recieved but my Project is to send sms and the MCU COntrol devices automatically so i won't be home to delete the recieved message i wish u understand me.say if i want to switch of device no.1 and after a while i want to switch on device no.2 it also will be by an sms by that way that at+cmgr=1 i'll read the sms that is responsible for deice no.1 and the MCU will not read the SMS no.2

d)when i write AT^SMGR=1 it gives me an error this command is not supported.

i got an idea if i could make the mobile it self to store the read message in the SE and once a new sms recieved it store it in "ME" then after reading it it is sent automatically to the "SM". but i don't how how to do this or is it possible or not.

aratti
- 12th April 2009, 19:35
Ok your phone doesn't support the MT memory location so use the ME. Also your phone does't support the command AT^SMGR=1 fine use AT+SMGR=1.

Still you need to clean all the memory ME from all the sms present, and your pic micro should enquire the modem and check if a sms is present. If one sms is present then your pic program will decode it and takes the appropriate action, at the end, before returning to the main routine, the pic program must DELETE the sms so that the phone memory ME returns to be clean again. To do that your pic program will send the following command : AT+CMGD=1

Al.

Pic2008
- 30th April 2009, 18:08
I can send and receive SMS in "text mode" using a Siemens GSM module connected to PIC.

I'm sending 2 chars AB from a remote mobile phone. In the PIC, it can receive AB.

I have declared

data var byte [4]
message var byte [4]



ws:
HSEROUT["AT+CMGL=",34,"REC UNREAD",34,13,10]

HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR message\3\13]

data[1] ="A"
data[2]="B"

if I compare message[1] with data[1], message[2] with data[2] both are equal.








However, if I were to sent ABC SMS to PIC, the following comparison give an error. Why?


ws:
HSEROUT["AT+CMGL=",34,"REC UNREAD",34,13,10]

HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR message\4\13]

data[1] ="A"
data[2]="B"
data[3]="C"

if I compare message[1] with data[1], message[2] with data[2], message[3] with data[3], error in the comparison

aratti
- 30th April 2009, 23:10
This is your code


HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR message\4\13]


Tray to remove \13 writing the code this way:


HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR message\4]


Al.

Pic2008
- 1st May 2009, 03:18
No luck. Actually I declare variable message VAR BYTE
I tried to send back SMS for message\4

This is what I got when I send ABC earlier to this GSM module.

AB9



If I send ABCDEF and i use HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR message\6]

I will get AB987

where 9 is from telbr[5], 8 is from telbr[6], 7 is from telbr[7]

Not sure why it wrap back to telbr for message.


Now it get more interesting if i declare variable as
message VAR BYTE[4]

If send ABC, I will get number from telbr[6], telbr[7], telbr[8] //(3 chars)

aratti
- 1st May 2009, 08:15
I suggest you to connect your modem to the PC serial port and repeat the experiment, reading the whole string the modem send out.
Re-check the position of your characters (along with your skip command) and verify if their position is stable even when the sms message change in lenght.

Very likely you will find necessary to change Skip value in your code

Al.

Pic2008
- 4th May 2009, 02:20
Thanks Arati for the advice.

Using AT+CMGL command, assuming if I got more than 1 new SMS within the same time period, how would I go about reading/detecting the next new SMS?

Should I just jump to the next memory location and use a for loop until the gsm module return an error?

aratti
- 4th May 2009, 20:56
Should I just jump to the next memory location and use a for loop until the gsm module return an error?

This is one solution and should work! I still prefer deleting the sms once read and serviced and leave the memory empty.

Al.

Pic2008
- 12th May 2009, 15:16
Using AT+CMGS= to send the sms to a tel number.

Is there another way where I can put more than 1 tel number and send the same sms at the same time together, so I dont have to repeat the above command again?

aratti
- 12th May 2009, 17:26
No luck!,the answer to your question is no!
You must do it in your software where you use a FOR/NEXT loop and at each loop you collect a new phone # from pic eeprom memory and you call "AT+CMGS" sending the same message to each phones as per your eeprom database.


Al.