C# 串口和超级终端

C# serialport and hyperterminal(C# 串口和超级终端)
本文介绍了C# 串口和超级终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 c# 和 Serialport 和 com0com(虚拟串行端口)我的问题是我的 c# 应用程序无法从超级终端接收数据,事件 DataRecived 没有被触发,如果我手动调用 readExisting 我什么也得不到要测试这个问题,你可以创建一个像这个有同样问题的基本 c# 应用程序 http://balau82.wordpress.com/2009/04/18/simplest-serial-port-terminal-in-csharp/ ,如果你运行这个应用程序的 2 个实例没问题,但是如果您运行一个实例和超级终端,则数据将从 C# 发送到 hiperterminal,而不是从超级终端返回.

i am using c# and Serialport and com0com(virtual serial ports) My problem is that my c# application can't recive data from hyperterminal,the event DataRecived is not fired and if i call manualy the readExisting i get nothing To test this problem you can create a basic c# app like this one that has same problem http://balau82.wordpress.com/2009/04/18/simplest-serial-port-terminal-in-csharp/ , if you run 2 instances of this app all is ok, but if you run one instance andne hyperterminal the data is send from C# to hiperterminal but not from hyperterm back.

推荐答案

太简单了,保证不行.您需要在 SerialPort 上设置通信属性以将它们与超级终端匹配.至少波特率、数据位、奇偶校验和停止位.如果没有检测到在线设备,超级终端将不会发送任何内容.您必须将 RtsEnable 和 DtrEnable 属性设置为 true.

It's rather too simple, guaranteed to not work. You'll need to set the communication properties on the SerialPort to match them with HyperTerminal. Baudrate, DataBits, Parity and StopBits at least. And HyperTerminal won't send anything if it doesn't detect the device on-line. You have to set the RtsEnable and DtrEnable properties to true.

这篇关于C# 串口和超级终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)