PDA

View Full Version : Weird behavior of my GSM Modem or Problem with my Code?



Megahertz
- 19th March 2012, 16:20
I collect the received SMS using this string :


DEBUGIN 5000,main2,[WAIT("UNREAD"), SKIP 3,STR num\13, SKIP 27,STR sms\25\13]


The problem is that when I display the received sms string using the following:

DEBUG "Num=",STR Num\13," SMS=",STR SMS,13,10

I get a very strange problem, which is that a SPACE comes before the sms string for some reason. However, when I do the same with another incoming SMS, the sms string stores it fine.

What is mean is this: (When the Debug command is executed)


Num=1111111111111 SMS=admin
Num=1111111111111 SMS= admin ' Notice the space before admin

I am scratching my head to find out why this is happening. If I change the SKIP 27 to 28 then I loose my first alphabet in some cases.

I also tried the following:


If (SMS[0]=26) OR (SMS[0]=13) OR (sms[0]=10) then
for a= 0 to 23
SMS[a]=SMS[A+1]
next a
Endif


But the code never enters this loop to correct this error for some reason. Any ideas???