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.






Bookmarks