$regfile = "m128def.dat"
$crystal = 8000000
Dim I As Byte
Dim J As Byte
Dim I1 As Byte
Dim J1 As Byte
Dim Pdu_len As Byte
Dim Smslen As Byte
Dim K As Byte
Dim K1 As Byte
Dim K2 As Byte
Dim K3 As Byte
Dim K4 As Byte
Dim Jj As Byte
Dim Txt As String * 320
Dim Pdutest As String * 320
Dim X As String * 2
Dim X1 As String * 2
Jj = 0
'convert smstxt to pdu
Do
J = Lookup(jj , Smstxt)
Incr Jj
Loop Until J = 0
Smslen = Jj - 1
Pdutest = ""
I = 0
J = 1
Do
K1 = Lookup(i , Smstxt)
K2 = Lookup(j , Smstxt)
K = I Mod 8
Shift K1 , Right , K
K = 7 - K
Shift K2 , Left , K
K1 = K1 + K2
Print Hex(k1);
Pdutest = Pdutest + Hex(k1)
Incr I
Incr J
If K = 1 Then
Incr J
Incr I
End If
Loop Until I >= Smslen
'convert(pdu) to text
Print ""
Jj = 0
I = 0
J = 1
I1 = 1
J1 = 3
Pdu_len = Len(pdutest)
Pdu_len = Pdu_len / 2
Do
X = Mid(pdutest , I1 , 2)
X1 = Mid(pdutest , J1 , 2)
K1 = Hexval(x)
K2 = Hexval(x1)
K = I Mod 7
K3 = K1
If K = 0 Then K1 = K1 And 127
If K = 1 Then K1 = K1 And 63
If K = 2 Then K1 = K1 And 31
If K = 3 Then K1 = K1 And 15
If K = 4 Then K1 = K1 And 7
If K = 5 Then K1 = K1 And 3
If K = 6 Then K1 = K1 And 1
Jj = K + 1
Shift K1 , Left , K
K = 7 - K
Shift K3 , Right , K
If K = 7 Then
Print Chr(k1);
Else
K1 = K1 + K4
Print Chr(k1);
End If
If K = 1 Then
Print Chr(k3);
K3 = 0
End If
K4 = K3
I1 = I1 + 2
J1 = J1 + 2
Incr I
Incr J
Loop Until I >= Pdu_len
End
Smstxt:
Data "Hey Bascom Users now I can convert smsmsg from text > pdu and from pdu > text can you make it more simple in the code ?"
|