'$sim ' Quick and durty sample to send SMS in PDU format ' ' ' Equipment: ' Siemens C35i GSM phone, ' (it might work also with other Simens GSM terminal from ' from 35 line) ' Siemens Data Cable ' Bascom test board with 22.118400 Mhz crystal ' $regfile = "89s8252.dat" $baud = 19200 $crystal = 22118400 'Work bytes: Dim I As Byte Dim J As Byte Dim K1 As Byte Dim K2 As Byte Dim K As Byte ' the length of the telephone number where the message is to be send Dim Dolzstev As Byte ' the length of the message in characters Dim Dolzspor As Byte ' the length of the entire command Dim Dolztele As Byte Wait 1 ' Let us wait a litle, let all equipment stabilize after power on ' The recipient telephone nuber as well as the message itself ' shoul be preprocessed before send to Siemens ' First we should know the length of both ' ------------------ ' Let us find out the length of the telephone no! I = 0 Do J = Lookup(i , Telno) Incr I Loop Until J = 0 Dolzstev = I - 1 ' The length of telephone number is now saved in Dolzstev ' -------------------- ' Let us find out the length of the message no! I = 0 Do J = Lookup(i , Sporocilo) Incr I Loop Until J = 0 Dolzspor = I - 1 ' The length of the message is now saved in Dolzspor ' -------------------- ' with this both length we now calculate the length of the entire command ' We need it for command AT+CMGS=xx ' I = Dolzstev Mod 2 J = Dolzstev / 2 I = I + J Dolztele = 7 + I I = Dolzspor Mod 8 J = Dolzspor / 8 J = J * 7 J = J + I Dolztele = Dolztele + J ' The length of command is now saved in Dolztele ' ' While the Siemens C35i accepts SMS only in PDU mode, there is no need ' to switch to PDU mode with AT+CMFG=0 command. ' ' We just send AT+CMGS=nn advertisement, we are going to ' send SMS Print "AT+CMGS=" ; Dolztele Wait 1 ' Now we begin to send ' prefix first Print "000100"; ' Now follows the recipients telephone no. ' It has do be in international format beginning with the ' no of the country ' for example : 386 Slovenia ' 41 area code or in our example ' code of the GSM operater Mobitel ' 123456 local no ' so: 38641123456 ' converted no looks like this: ' 8346614523F1 ' two and two figures exchanged and if no of figures is odd ' an F is added ' This routine does it: Printhex Dolzstev; Print "91"; For I = 0 To Dolzstev Step 2 J = I + 1 If J >= Dolzstev Then Print "F"; Else K1 = Lookup(j , Telno) Print Chr(k1); End If K1 = Lookup(i , Telno) Print Chr(k1); Next ' Now some atributes follow, 0000 does fine Print "0000"; ' Now follows compression 8 character in 7 bytes ' how it should be done, read ' http://www.dreamfabric.com/sms/hello.html Printhex Dolzspor; I = 0 J = 1 Do K1 = Lookup(i , Sporocilo ) K2 = Lookup(j , Sporocilo) K = I Mod 8 Shift K1 , Right , K K = 7 - K Shift K2 , Left , K K1 = K1 + K2 Printhex K1; Incr I Incr J If K = 1 Then Incr J Incr I End If Loop Until I >= Dolzspor ' At the end we send character Print Chr(26); ' Thats all, folks! End Telno: ' Telephone number should begin with country code Data "38641123456" ' Here comes the message text: Sporocilo: Data "hellohello"