Pic to GSM Phone connection (HSerin problems)


Closed Thread
Results 1 to 40 of 289

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,184

    Default

    On the following code the phone responds ..."REC READ",... if the message was read sometime before. If you have a fresh new message then this becomes UNREAD as you state on your code.

    So, why don't you change your code to:

    HSerin 5000,loop,[wait("READ"),... since the word READ is present all the time?

    Ioannis

    ' +CMGR: "REC READ","+xx1234567890",,"05/05/26,17:19:23+00" GOOD
    ' Loop could be setup as a routine such as:
    ' Loop:
    ' List new Messages again - as above (think about it)
    ' HSerout ["AT+CMGL",13,10]

    HSerin 5000,loop,[wait("UNREAD"),skip 3,STR Caller\13,skip 4,STR GSMTime\17,skip 6, STR GSMBUFFER\16\13]

  2. #2
    Royce's Avatar
    Royce Guest

    Default

    Thank you for the info.

    I was wondering if you could tell me how I should use the data that is captured within the GSMBuffer i.e. the SMS text as I would like use this to switch on an LED. Should it be something like this:

    IF GSMBuffer = Switch on then LED = 1

    Thanks in advance.

    Kind Regards,
    Royce

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,184

    Default

    PBP does not have such string compring capabilities.

    You have to make your own subroutine to compare byte to byte the two string array. Like that:

    i=0
    while i less_than gsmbuffer_length (I cant sen the less character! Why?)

    if gsmbuffer[i]=compare_array[i] then
    'gsmbuffer[i]=0
    i=i+1
    else
    goto wrong_sms
    endif
    wend
    correct_sms:
    'your code here

    wrong_sms:
    'your code here

    You understand that in compare_array you have to put your characters in some other place of the program prior to the above subroutine.
    Last edited by Ioannis; - 26th July 2005 at 10:25.

  4. #4
    Royce's Avatar
    Royce Guest

    Default

    Thanks again but I'm afraid I dont quite understand. Really sorry but would it be possible to be little clearer.

    Thanks again.

    Kind Regards,
    Royce

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,184

    Default

    Hmm, what part you are not understanding?

    Ioannis

  6. #6
    Royce's Avatar
    Royce Guest

    Default

    Sorry.... would it be possible to add comments to each of the following lines:

    You have to make your own subroutine to compare byte to byte the two string array. Like that:

    i=0
    while i less_than gsmbuffer_length (I cant sen the less character! Why?)

    if gsmbuffer[i]=compare_array[i] then
    'gsmbuffer[i]=0
    i=i+1
    else
    goto wrong_sms
    endif
    wend
    correct_sms:
    'your code here

    wrong_sms:
    'your code here

    Could you give me an example using the SMS keyword: "switch on" in order to switch on an LED.

    Thanks again.

    Regards,
    Royce

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,184

    Default

    The commands used in the small piece of code are very elementary. So you have to read the manual because all the answers are in there.

    I cannot explain how an If-Then-EndIf statement is syntaxed or how is working. The code I gave you is very very easy and basic I could say.

    It is comparing one element of the array gsmbuffer at a time with one element of the other array. If it succeeds then it is moving on to the part of the program labeled:

    correct_sms:
    'you add your code here

    If it does not succeed then it is moving on to the part of the program labeled:

    wrong_sms:
    'you add your code here

    Try to write some code and see what happens. One part at a time...

    Ioannis

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  3. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 20:33
  4. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  5. Pic to GSM Phone connection
    By samertop in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th July 2005, 13:40

Members who have read this thread : 0

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