+ Reply to Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Nov 2008
    Posts
    11

    Default Help me To read Last recieved sms from hyper terminal

    Hello every body


    Hi, we are pleased to see that you are using our forum.

    We'd like you to become a member of our community. Membership is FREE, please REGISTER and view our forums without these annoying reminders!

    Once registered you may post on the forums, download from the file areas and use the WIKI without interruption.






    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:



    plz i need help as soon as possible

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    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.
    All progress began with an idea

  3. #3
    Join Date
    Nov 2008
    Posts
    11

    Default

    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.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    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.
    All progress began with an idea

  5. #5
    Join Date
    Nov 2008
    Posts
    11

    Default

    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:

    b) Here is a list of the memory location "SM"

    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.

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    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.
    All progress began with an idea

  7. #7
    Join Date
    Aug 2008
    Posts
    66

    Question

    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]

    Code:
    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?
    Code:
    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
    Last edited by Pic2008; - 30th April 2009 at 18:10.

  8. #8
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    This is your code

    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:

    Code:
    HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR message\4]
    Al.
    All progress began with an idea

  9. #9
    Join Date
    Aug 2008
    Posts
    66

    Default

    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)
    Last edited by Pic2008; - 1st May 2009 at 03:32.

  10. #10
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    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.
    All progress began with an idea

  11. #11
    Join Date
    Aug 2008
    Posts
    66

    Default

    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?

  12. #12
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    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.
    All progress began with an idea

  13. #13
    Join Date
    Aug 2008
    Posts
    66

    Default

    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?

  14. #14
    Join Date
    May 2008
    Location
    Italy
    Posts
    792

    Default

    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.
    All progress began with an idea

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  3. Hyper Terminal Setting for TTL putput
    By ClayE in forum Serial
    Replies: 6
    Last Post: - 7th June 2008, 06:50
  4. Write and Read from eeprom
    By savnik in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 9th June 2007, 14:56
  5. what is hyper terminal?
    By moud_man in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th September 2005, 19:33

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts