VB开发道闸OCX的有关问题
VB开发道闸OCX的问题
为什么inputStream获取的状态为空呢?如何获取道闸状态呐???
------解决方案--------------------
先检查硬件,再检查软件设置
------解决方案--------------------
该回复于2010-10-26 10:45:00被版主删除
------解决方案--------------------
Private Function Execute(order As Variant)
WriteLog (Time() & ": Transmitting " & order & "......")
MSCom.OutBufferCount = 0 '清空等待传送的字符个数
MSCom.Output = order '向道闸发送指令
WriteLog (Time() & ": Size of " & MSCom.InBufferCount & ".")
inputStream = "" '清空上次状态
inputStream = MSCom.Input '获取本次状态
WriteLog (Time() & ": Received " & inputStream & ".")
End Function
Public Function GetState() As String
' inputStream = MSCom.Input
If StrComp(inputStream, "#RR~") = 0 Then '已复位且准备好
GetState = "Ready"
Exit Function
End If
If StrComp(inputStream, "#VV~") = 0 Then '闸杆已达垂直位置
GetState = "Vertical"
Exit Function
End If
If StrComp(inputStream, "#MM~") = 0 Then '闸杆处于中间过渡位置
GetState = "Midst"
Exit Function
End If
If StrComp(inputStream, "#HH~") = 0 Then '闸杆已达水平位置
GetState = "Horizontal"
Exit Function
End If
If StrComp(inputStream, "#EE~") = 0 Then '闸杆因故超时(6秒)未动作到位
GetState = "Overtime"
Exit Function
End If
If StrComp(inputStream, "#CC~") = 0 Then '车辆进入感应区
GetState = "InInduction"
Exit Function
End If
If StrComp(inputStream, "#GG~") = 0 Then '车辆离开感应区
GetState = "OutInduction"
Exit Function
End If
GetState = "NULL"
End Function
为什么inputStream获取的状态为空呢?如何获取道闸状态呐???
------解决方案--------------------
先检查硬件,再检查软件设置
------解决方案--------------------
该回复于2010-10-26 10:45:00被版主删除
------解决方案--------------------