1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| Private Sub Command1_Click()
Text1.Text = ""
strBuffer = ""
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
With MSComm1
.CommPort = Combo1.Text
.Settings = "115200,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True
.Output = "AT+CUSD=1," & Chr(34) & "*710#" & Chr(34) & ",15" & vbCrLf
End With
End Sub
Private Sub MSComm1_OnComm()
strBuffer = strBuffer & MSComm1.Input
Dim x As String
If InStr(1, strBuffer, ",15") Then
Dim s() As String
s = Split(strBuffer, vbCrLf)
Dim i As Integer
For i = 0 To UBound(s)
If InStr(1, s(i), "+CUSD") Then
x = s(i)
End If
Next
End If
If x <> "" Then
s = Split(x, ",")
Text1.Text = Mid$(s(1), 2, Len(s(1)) - 2)
End If
End Sub
Text2.Text = ""
strBuffer = ""
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
With MSComm1
.CommPort = 8
.Settings = "115200,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True
.Output = "AT+CUSD=1," & Chr(34) & "*770*"0773860112*100*00000#" & Chr(34) & ",15" & vbCrLf
End With
End Sub |
Partager