为什么接收不到串口的数据?
Private Sub oCommTimer_Timer()
Dim oCommStream As Object
Set oCommStream = oGpsDataServer.GetCommStream
If TypeName(oCommStream) = "CCommStream" Then
oCommStream.GetInputBuff
End If
End Sub
然后
Public Sub GetInputBuff() /被上面函数调用
Dim strInput As String
Dim i As Integer
Dim A As String
Dim B As String
Dim C As String
m_oComm.OutBufferCount = 0
m_oComm.InBufferCount = 0
On Error GoTo errhandle
m_oComm.Output = "AT" & vbCrLf /向串口发送AT指令,得到的响应应该是OK
Call SleepIt(1)
strInput = m_oComm.Input
A = strInput
MsgBox A /但收不到串口发回来的OK
m_oComm.Output = "AT+CMGF=1" & vbCrLf /向串口发送AT+CMGF=1指令,得到的响应应该是OK
Call SleepIt(1)
strInput = m_oComm.Input
B = strInput
MsgBox B /现在同样收不到
m_oComm.Output = "AT+CMGR=1" & vbCrLf
Call SleepIt(1)
strInput = m_oComm.Input
C = strInput
MsgBox C
End Select
strInput = Mid(C, 59, 43)
延迟函数
Public Sub SleepIt(SleepTime As Double)
Dim bdt As Boolean
bdt = True
Do While bdt
SleepTime = SleepTime + 1
If SleepTime > 10000 Then bdt = False
Loop
End Sub
请问这是为什么??应该怎么改动?