进制它针对的是操作,对,操作,而不是针对数据,比如你下发5 他针对的是键盘5 具体查看ASCII 而不是数据5
InputMode
comInputModeText 文本方式
看到的是文本,只能使用如下代码 text=Comm1.Input,否则没有数据
comInputModeBinary二进制 :看到的是ascii
在串口接收模块进行如下操作
strBuff = Comm1.Input
BytReceived() = strBuff
For i = 0 To UBound(BytReceived)
Print "BytReceived(" & i & ")"; BytReceived(i)
If Len(Hex(BytReceived(i))) = 1 Then
strData = strData & "0" & Hex(BytReceived(i))
Else
strData = strData & Hex(BytReceived(i))
End If
Next
lblReceive = strData
strData = ""
从串口助手发送1 :在comInputModeBinary模式下strData 31
BytReceived(0) 49
在comInputModeText strData 3100
BytReceived(0) 49
BytReceived(1) 0