我有一个串口通信程序如后,RS232的2脚和3脚短接,为何 Text5.Text总只显示一个字符
请指教!!!
  Dim  c, d,  OutByte,InByte() As String
         c =5
         d =6
         OutByte = "T" & c & d
      MSComm1.Output = OutByte   '送出数据
      TimeDelay 100
      InByte = MSComm1.Input
      For i = LBound(InByte) To UBound(InByte)
      Text4.Text = Text4.Text + Chr(InByte(i))
        Next i
      If UBound(InByte) > 3 Then
          Text5.Text = Chr(InByte(0)) & Chr(InByte(1))
         end if

解决方案 »

  1.   

    希望看到你完整的代码,就好象给一个鸟的脚,叫我们去识别是什么鸟一样,你的MSComm1属性设置是怎么样的?接受的时候是字符还是2进制格式呢?
      

  2.   

    串口属性为: .CommPort = 2  
        .Settings = "4800,n,8,1"    
        .PortOpen = True    '打开串口
        .InputMode = .CommPort = 1   '选择串口号
        .Settings = "9600,n,8,1"    '设置波特率,默认为9600
        .PortOpen = True    '打开串口
        .InputMode =0-comInputModeText
      其他是默认设置