首页 > 解决方案 > 串口打开时 RTS 和 DTR 高

问题描述

谁能告诉我如何在使用 wish85 打开串行端口时停止 RTS 和 DTR 开启?

附图显示了轮流发生的事情。

当您在 C# 中使用 Visual Studio 打开串行端口时,这似乎不会发生。在此处输入图像描述

在TCL,我用过

set com [open com7: w]
fconfigure $com -ttycontrol {DTR 0}
fconfigure $com -ttycontrol {RTS 0}

在 C# 中它只是

SerialPort sp = new SerialPort("COM7", 300);
sp.Open();  // to open the port

标签: serial-porttcl

解决方案


在 C# 中,默认设置为 0。对于握手,根据https://docs.microsoft.com/en-us/dotnet/api/system.io.ports.handshake?view=netframework-4.7.2 , 0=不握手。

如果您查看 tcl on serial ports 的 wiki 页面,在握手下,它说没有默认的握手配置:这取决于您的操作系统。

据推测,默认为 RTS/CTS。如果您不想要任何握手,则指定无握手。不幸的是,在 tcl 中,你不能查询这个 - 它是一个只写值。


推荐阅读