【问题标题】:RTS and DTR High on serialport open串口打开时 RTS 和 DTR 高
【发布时间】:2019-01-25 05:22:14
【问题描述】:

谁能告诉我如何在使用 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

【问题讨论】:

  • 您是在 C# 中使用 RTS/CTS 流控制还是 XOn/XOff?能否展示一下如何在 C# 和 TCL 中打开串口。
  • Morning cup 我不知道如何正确地将代码放入 cmets 但在 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(); 打开端口
  • 我已经为您修改了您的问题。请检查那是你想要写的。

标签: serial-port tcl


【解决方案1】:

在 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 中,你不能查询这个 - 它是一个只写值。

【讨论】:

    猜你喜欢
    • 2019-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    相关资源
    最近更新 更多