如何检查没有响应来自C#中的串行端口 [英] how to check no response is coming from serial port in C#

查看:60
本文介绍了如何检查没有响应来自C#中的串行端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查C#中的串口是否没有响应

how to check no response is coming from serial port in C#

推荐答案

您可以为串口使用DataReceived事件:
You can use the DataReceived event for the serial port:
_serialPort.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);


只需添加此事件处理程序,然后检查是否有意义的时间内返回响应.


Just add this event handler and check if a response if comming back in a meaningful time.


hiii,
要检查响应,您需要在通信中使用确认.
希望本文对您有所帮助.

使用C#改善串行端口的性能 [ ^ ]
hiii,
To check responce you need to use acknowledgement in communication.
hope this article will help you.

Improving the Performance of Serial Ports Using C#[^]


这篇关于如何检查没有响应来自C#中的串行端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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