Reading a SMS to an array


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2008
    Posts
    3

    Smile Reading a SMS to an array

    Dear friends. I need some help reading a SMS into an array. I tried the below code but it doesn't seem to work properly.

    I am using harware interrupts to get into an interrupt routine when a SMS is received. I want to check for +CMTI: "SM" ,1 string and extract the SMS location to a variable called sms_location. Then I want to use AT_CMGR command to read that SMS location and put the receiving message into sms_array.

    hserin 1000, start, [wait("CMTI:"), skip 6, DEC2 sms_location]
    hserout ["AT+CMGR=", sms_location, 13, 10]
    hserin 1000, ff, [STR sms_array\100]


    Then I can parse the sms_array and remove all unnecessary data. The above code segment compiles but I it doesn't read the correct SMS location.

    instead if I replace the 2nd line above with
    hserout ["AT+CMGR=1", 13, 10]
    then it reads the SMS location 1 and puts the data to smsm_array nicely.

    I would appreciate any help from you nice people.

  2. #2
    Join Date
    Jul 2003
    Location
    Lancashire
    Posts
    50

    Default

    Hi

    Just a thought, I could be wrong.
    when you use hserin 1000, start, [wait("CMTI:"), skip 6, DEC2 sms_location, sms_location will contain a number, 2 digits say 01.
    I have a feeling that the modem will require it passed in ASCII and not in the form its in.
    when you do hserout ["AT+CMGR=1", 13, 10] I think it will send the 1 as ASCII $31 Decimal 49 and what your sms_location passes is ASCII char 11

    Cheers Pete

  3. #3
    Join Date
    May 2008
    Posts
    3

    Default Reading a SMS to an array

    Hi Pete,

    Thanks a lot for pointing it out. Yes you are right. I have changed the line to

    hserout ["AT+CMGR=", #sms_location, 13, 10]

    Now it sends ASCII and it works fine. !!!

    Kamal

  4. #4
    Join Date
    Jul 2003
    Location
    Lancashire
    Posts
    50

    Default

    Hi KA5MAL

    Glad to be of help!

    Cheers Pete

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 05:46
  3. Replies: 11
    Last Post: - 19th August 2009, 16:23
  4. WRITECODE stores wrong 14-bit word values in FlashMEM
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2009, 05:35
  5. Reading Array values into variables
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 21st March 2005, 11:30

Members who have read this thread : 1

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