serial-port - 串口打开时 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
解决方案
在 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 中,你不能查询这个 - 它是一个只写值。
推荐阅读
- python - 如何以交替的反向和字母顺序打印字母?
- php - PHP - 如何使用 php curl 而不是表单提交来发送发布请求,然后重定向页面?
- node.js - 我的 npm install -g react-native-cli 不工作
- c# - 启用后如何选择() NumericUpDown?
- selenium-webdriver - 在我的测试脚本中,它必须单击一个按钮,但它使用 Cucumber 单击 selenium webdriver 中的其他按钮
- python - 当我将 .get_text() 用于 BeautifulSoup 时,什么也没有出现
- emacs - 使用 Helm 时,如何使 TAB 循环通过我的命令完整选项?
- reactjs - React TypeScript 16.8 如何在两个兄弟组件之间共享数据
- javascript - Onclick使用Jquery添加边框底部
- c++ - 在 IF 语句中比较 int 时的奇怪行为