串口字节读取 [英] serial port byte read

查看:153
本文介绍了串口字节读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



i是vb的新手并且已经阅读了很多但似乎停留在从串口读取数据字节以显示在richtextbox。

i连接到端口ok并且学会了获取所有的com并设置波特率但是数据的显示正在向我发送弯曲。我有一个rfid阅读器,不断发送数据包,我可以在其他程序中看到这一点,但我希望能够抓取数据并在文本框中显示它。数据流是十六进制字节,我有协议,能够剥离各种项目,但想从头开始学习基础知识。

任何人的帮助将不胜感激。

Hi all

i am new to vb and have been reading a lot but seem to be stuck on getting the data bytes read from the serial port to display in a richtextbox.
i make the connection to the port ok and have learned to get all the coms and set the baudrate but the display of data is sending me round the bend. i have an rfid reader that is continuously sending packets of data i can see this in other programs but i want to be able to grab the data and show it off in a textbox. the data stream is hex bytes and i have the protocols to be able to strip out various items but want to start from scratch and learn the basics.
help from anyone would be appreciated.

推荐答案

从头开始:处理 SerialPort.DataReceived [ ^ ]事件,并获取原始数据。



将此添加到文本框(作为十六进制值或其他)到显示它收到罚款,然后将其分类为数据块并提取数据包信息。
Start at the beginning: Handle the SerialPort.DataReceived[^] event, and fetch the raw data.

Add this to your text box (as hex values or whatever) to show it is receiving fine, and then work on sorting it into blocks of data and extracting the packet info.


这篇关于串口字节读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆