精选优质文档-倾情为你奉上Private Sub Form_Load() 设置打开端口 If OpenPort(3) = False Then MsgBox 串口打开失败! End IfEnd SubPrivate Sub Command1_Click() Dim sBuf(2) As Byte sBuf(0) = &H55 sBuf(1) = &H31 sBuf(2) = &HFF If SendByte(sBuf) = False Then End IfEnd Sub收到数据产生MSComm事件Private Sub MSComm1_OnComm() Dim i As Integer Dim rBuf() As Byte rBuf = MSComm1.Input For i = 0 To UBound(rBuf) Debug.Print rBuf(i) Next iEnd Sub串口初始化Private Function OpenPort(PortNum As In