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# 串口和超级终端
基础教程推荐
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
