我需要一个串口2进制发送和接受程序,用8位的2进制数就可以了,要实现发送和接受这个过程

解决方案 »

  1.   

    Option ExplicitPrivate Sub Command1_Click() '发送
        Dim arr(4) As Byte
        arr(0) = 78
        arr(1) = 78
        arr(2) = 78
        arr(3) = 78
        arr(4) = 78
        MSComm1.Output = arr
    End SubPrivate Sub Command2_Click() '接收
        Dim js() As Byte
        Dim l As Integer
        Dim i As Integer
        js = MSComm1.Input
        l = UBound(js)
        For i = 0 To l
            Text1(i) = Hex(js(i))
        Next
    End SubPrivate Sub Form_Load()
        MSComm1.CommPort = 1
        MSComm1.Settings = "9600,n,8,1"
        MSComm1.InputMode = comInputModeBinary
        MSComm1.PortOpen = True
    End Sub
      

  2.   

    能写个程序吗?发到我信箱里来[email protected]
    你这样输出的是什么?
    接受的时候Text1(i)是什么?
      

  3.   

    我需要的是有oncomm事件的,不是就这样的接受和发送,需要触发oncomm事件的