wait for a string


Results 1 to 12 of 12

Threaded View

  1. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    This snippet should solve your problem.
    Code:
    EEprom 0,[49,55,49,55,49,48,57,53,57]  '  your number without the area code 1717101959
    
    InBox    var Byte  [8] ' make your array larger so you can use a byte as command
    Num0    var Byte  [9]
    Num1    var Byte  [9]
    Flag      var byte
    Try        var Byte
    A0        var Byte
    
    For A0=0 to 9
    Read A0,Num0[A0] ' here you load you number in array Num0
    Next A0
    
    
    IniCall:
    Try=Try+1
    If Try>5 then delet_sms ' if counter >5 then abort ( if 5 cycles are too many reduce them to an acceptable number)
    SerOut2 txd,Baud,["at+cmgr=5",13]
    SerIn2 rxd,Baud,1000,IniCall,[wait ("+880"),Str Num1\9,skip 32,str inbox\8] ' here you load the incoming number into array Num1
    
    Try=0
    Flag=1
    For A0=0 to 9
    If Num0[A0]<>Num1[A0] then Flag=0 ' here you compare the two array if not all digits agree then Flag is set to zero
    next A0
    
    If flag=0 then delet_sms ' flag reports "not corrected number" so delete sms
    
    
    'your code here to work with the array  inbox
    
    goto mainLoop ' your code mainLoop
    
    delet_sms:
    Try=0
    
    ' your code for deleting sms
    
    
    'If you make an  inbox array equal to 11 elements then you can use it to change the number when needed
    For instance if inbox[10]= 100 then gosub Change 
    
    
    Change:
    
    For A0 =0 to 9
    Write A0, inbox[A0]
    Num0[A0]=inbox[A0]
    Next A0
    Return

    Your number is stored into the eeprom and is loaded in the array Num0 at runtime. I am not sure if "880" is the area code.

    If Try>5 then there is not sms, so you don't need to delete it. Trying to delete is dangerous because you could delete an incoming sms.

    Al.
    Last edited by aratti; - 1st April 2009 at 23:59.
    All progress began with an idea

Similar Threads

  1. How about String Variables?
    By mytekcontrols in forum PBP Wish List
    Replies: 40
    Last Post: - 20th January 2015, 13:53
  2. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 15:46
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 22:07
  4. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 05:39
  5. USB Interface using PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 22nd May 2006, 17:04

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