Receiving Different String lengths


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Unhappy Receiving Different String lengths

    Hi my Friends.

    I am trying to receive incoming messages from a GSM modem, using Serin2 command and display it on a 20 x 4 LCD display. First 80 and then last 80

    Incoming messages may vary from 1 to 160 characters including a constant qualifier.

    All work well if the number of characters is 160.
    I break it up as 2 sets of 80 chars (first 80 on LCD pause a few seconds and then last 80).

    Serin2 Si,17197,3000,Unlock,[wait ("+27"),str IntNo[1]\9,skip 4,_
    str Date[1]\8,skip 1,str Time[1]\8,wait ("$@"),_
    str CmdStr[1]\80,str CmdStr2[1]\80]

    If it is less than 160, it time out and nothing displays

    Thanks for your help !

    Jannie

  2. #2
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130

    Default

    Hi Jannie,
    I can think of two things you might try. First, after you have the \80 in your serin command, add a \13 at the end. This will stop receiving the string variable if there is a carriage return (13) in the incoming message. You may have to find another character to signal the end of your message besides 13, but this might get you started. The other method would require using a hardware uart and keep checking the RCIF flag to see if there is a character waiting to be read. When the buffer is empty you're finished.
    Personally, I recommend going with the hardware uart route, and using Darrel Taylor's Instant Interrupts. Then whenever there is data coming into the microprocessor from the modem, your program will go and get it.

    Good Luck,
    Jerry.
    If your oscilloscope costs more than your car...

  3. #3
    Join Date
    Jan 2009
    Posts
    4

    Default

    Thanks Jerry,

    I'll give it a try and let you know.
    Never used HSERIN before, worth a try.

    Thank you for the reply.

  4. #4
    Join Date
    Jan 2009
    Posts
    4

    Default

    Thanks Jerry,

    The carriage return / linefeed did the trick with SERIN2

    BR
    Jannie

  5. #5
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130

    Default

    Jannie,
    Excellent, I'm glad it worked. I've never used GSM, only CDMA, but I hoped the format for the SMS would be similar.
    Hserin can be used with faster speeds, Serin is more limited.

    Jerry
    If your oscilloscope costs more than your car...

  6. #6
    Join Date
    Jan 2009
    Posts
    4

    Default

    Thanks again Sir :-)

    Now 14 years in GSM/UMTS, quite interesting.

    BR
    Jannie

Similar Threads

  1. How about String Variables?
    By mytekcontrols in forum PBP Wish List
    Replies: 40
    Last Post: - 20th January 2015, 12:53
  2. Problem receiving string
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th October 2009, 07:24
  3. Embedded Strings in your Code Space
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 9th March 2008, 07:50
  4. How to convert HEX Value as formatted BIN String ?
    By Robson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2007, 02:16
  5. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04:39

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