And why especially message 5? Are yousure about this?
What if you have deleted already one and now you have 4 SMS?
Ioannis
And why especially message 5? Are yousure about this?
What if you have deleted already one and now you have 4 SMS?
Ioannis
Code:SerOut2 txd,Baud,["at+cmgr=5",13] SerIn2 rxd,Baud,500,delet_sms,[wait ("+8801717101959")]
I just read sms memory index 5, and check the sender no by waiting the phone no [wait ("+8801717101959")]. Its a authorized phone no. If the sender phone no don't match then I delete it. If match then i know what to do.(Tested)
I always read and delete index 5. So any new sms first arrive in index 5.
My problem is, the authorized phone no saved in EEprom. And its may change time to time. So I need to wait for a string type array.
I have tried with that . But compiler show error this line
Code:SerIn2 rxd,Baud,500,delet_sms,[wait("#str phoneno\14"),skip 32,str inbox\8]
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 22:59.
All progress began with an idea
My question still is what if you have deleted all SMS and the new valid arrives at location 1?
Ioannis
sms index 1,2,3,4 are used to store the emergency sms. These sms are used to notify the user .
Hi aratti . Thanks for your help. I have solved it.
Can you please inform me one more thing, When any new sms arrived, the GSM modem send a notification " +CMTI: "SM",5 " .
How i can use this notification to interrupt in my program.
Your program might be interrupted only by an Hardware Interrupt, say from the USART module.
So, if you want a fast interrupt system, have a look at Darrels Instant Interrupt.
Then every time you have an RS-232 activity, the ISR will take care of the event. Store the incoming data in an array and do a compare byte-to-byte with a stored reference array, say in the EEPROM.
I am working on a similar project and may post a snipet as soon as I get it working.
Ioannis
Bookmarks