以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请问下,有关e.Port.ReadExisting() (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=7491) |
-- 作者:baoxyang -- 发布时间:2010/6/30 15:12:00 -- 请问下,有关e.Port.ReadExisting() 串口发送的是二进制字节,请问下,如何使用的接收的数据也是二进制字节显示出来。e.Port.ReadExisting()接收的数据是乱码,应如何处理,请指教!!先谢了!!! |
-- 作者:狐狸爸爸 -- 发布时间:2010/6/30 15:21:00 -- With Ports("COM2") If .BytesToRead > 0 Then Dim b(.BytesToRead) As Byte b = .Read End If End With |
-- 作者:baoxyang -- 发布时间:2010/6/30 15:30:00 -- 以下是引用狐狸爸爸在2010-6-30 15:21:00的发言:
With Ports("COM2") If .BytesToRead > 0 Then Dim b(.BytesToRead) As Byte b = .Read End If End With 这个我知道,事例中有,比如想把串口接收数据(b字节数组字节全部显示在一个文本框中) 这个一时不知道如何编写?
|
-- 作者:狐狸爸爸 -- 发布时间:2010/6/30 15:36:00 -- With Ports("COM2") If .BytesToRead > 0 Then Dim b(.BytesToRead) As Byte b = .Read Dim v As String For Each t As Byte In Bytes v= v & t Next End If End With |