我有一个串口通信程序如后,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
请指教!!!
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
.Settings = "4800,n,8,1"
.PortOpen = True '打开串口
.InputMode = .CommPort = 1 '选择串口号
.Settings = "9600,n,8,1" '设置波特率,默认为9600
.PortOpen = True '打开串口
.InputMode =0-comInputModeText
其他是默认设置