计算机和设备进行通信
rthreshold设为23,传送二进制数据
但触发oncomm,传进来的数据大多数是30个(0--29),偶尔是8、6、18个
时不时的还Lbound()=0,Ubound()=-1
问题出在哪?
rthreshold设为23,传送二进制数据
但触发oncomm,传进来的数据大多数是30个(0--29),偶尔是8、6、18个
时不时的还Lbound()=0,Ubound()=-1
问题出在哪?
解决方案 »
- VB打开我在别的机器上做的程序是提示加载webvw.dll 文件失败 ,可我程序里根本没这个文件
- 我的查询语句 把结果放在datagrid中
- 请教:在VB中怎么样创建Access查询?
- 问一个和mdac_typ有关的问题
- 用datareport做报表,如何把两个Recordset连到同一张报表上一起打出来?
- 熟练使用VB、SQL SERVER 、ACCESS进行数据库开发、月薪多少才算公平!
- ★★★有QQ号码赠送!!你想要吗?(限量赠送!)
- help me! 关于VB中的calendar控件,在线等待
- 有谁做过医院管理系统?赶快帮助!
- 两 个程序交换数据的问题??
- 在线等,请问Print #1是什么意思啊
- 在报名系统中添加上传照片功能,如何实现?
Dim BytReceived() As Byte
Dim strData As StringPrivate Sub Form_Load()
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputMode = comInputModeBinary
MSComm1.RThreshold = 23
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm() '接收数据
Dim strBuff As String
Text1 = ""
Select Case MSComm1.CommEvent
Case 2
MSComm1.InputLen = 0
strBuff = MSComm1.Input
BytReceived() = strBuff
jieshou
'此处写接收后的数据处理代码
If Len(strData) = 46 Then
strData = ""
End If
End Select
End Sub
Public Function jieshou() '接收数据处理为16进制
Dim i As Integer
For i = 0 To UBound(BytReceived)
If Len(Hex(BytReceived(i))) = 1 Then
strData = strData & "0" & Hex(BytReceived(i))
Else
strData = strData & Hex(BytReceived(i))
End If
Next
Text1 = strData
Print Len(strData) / 2
End Function
rthreshold设为1,在接收代码中根据通信协议来判断.