C# serialport and hyperterminal(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# 串口和超级终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C# 串口和超级终端


基础教程推荐
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01