精易论坛

标题: 串口读取使用 [打印本页]

作者: kekoukele    时间: 2018-1-5 13:58
标题: 串口读取使用
为什么 SeialPortcom.BytesToRead  显示接收到数据  但是  int Datenums 没有数据呢  小白 请教

QQ截图20180105135605.png (5.57 KB, 下载次数: 2)

QQ截图20180105135605.png

作者: andwp    时间: 2018-1-5 21:00
正确写法
int DataNums = SerialPortcom.BytesToRead;
byte[] sbuf = new byte[DataNums];
作者: kekoukele    时间: 2018-2-8 15:03
初始化加上spToKeyBoarderial.DataReceived += new SerialDataReceivedEventHandler(spKeyboard_DataReceived);
spKeyboard_DataReceived  是我的方法 改成对应你的方法 不知道能不能解决
作者: 陈道友    时间: 2018-2-27 08:19
楼主,你这个SeialPortcom刚创建,还未连接设备,发送读取命令,当然没数据啊
作者: 初阳    时间: 2023-2-5 17:08
这玩意书能看明白




欢迎光临 精易论坛 (https://125.confly.eu.org/) Powered by Discuz! X3.4