当前位置:编程学习 > VB >>

vb 串口通信的数据问题,在线等。电脑显示不出来数据,求大神指点、qq343018772

Dim ReadMsg As String
 Dim BytReceived() As Byte
 Dim strBuff As String
 Dim i As Integer
   Select Case MSComm.CommEvent
        Case comEvReceive
       strBuff = MSComm.Input
       BytReceived() = strBuff
     For i = 0 To UBound(BytReceived)
         If Len(Hex(BytReceived(i))) = 1 Then
               ReadMsg = ReadMsg & "0" & Hex(BytReceived(i))
             Else
               ReadMsg = " " & ReadMsg & Hex(BytReceived(i))
         End If
     Next
    CurrPressure = Val(Mid(ReadMsg, 3, 3))
    CurrVolume = Val(Mid(ReadMsg, 6, 6))
end select --------------------编程问答-------------------- 是否初始化设置了MSComm1.RThreshold 为不等于0的整数
如:MSComm1.RThreshold = 1
--------------------编程问答-------------------- http://www.vbgood.com/thread-83700-1-1.html --------------------编程问答-------------------- 属性里设置了,debug.print mscomm.input  为空是怎么回事啊 --------------------编程问答-------------------- 大神们啊,指点吧?
补充:VB ,  COM/DCOM/COM+
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,