Compact 框架中的串行端口 - RTSEnable 和 DtrEnable
如何使用RTSEnable
和DtrEnable
? 我发现某些天平可以与我的应用程序通信,但其他天平即使设置匹配也无法通信。 (波特率、奇偶校验、数据位、停止位和握手)
串行端口设置保存在配置文件中,其想法是在需要时支持可能设置的不同组合。 通常,我们的设备被编程为具有 handshake = NONE
,但如果某些奇怪的设备不能具有 handshake=NONE
,我应该插入一个条件,例如:
if (serialport.Handshake != NONE) {
serialport.RTSEnable = true;
serialport.DtrEnable = true;
}
或者更确切地说,如果没有将 RTSEnable
和 DtrEnable
设置为 true
,其他握手(NONE
除外)是否可以正常工作?
How are RTSEnable
and DtrEnable
used? I am finding that some balances can communicate with my app but others can't even though the settings match. (baud rate, parity, data bits, stop bits and handshake)
The serial port settings are saved in the configurations file and the idea is to support different combinations of the possible settings, if needed. Normally, our devices are programmed to have handshake = NONE
, but in case some odd device can't have handshake=NONE
, should I insert a condition such as:
if (serialport.Handshake != NONE) {
serialport.RTSEnable = true;
serialport.DtrEnable = true;
}
Or rather, will other handshakes (other than NONE
) work without RTSEnable
and DtrEnable
being set to true
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是否需要硬件握手完全取决于您所连接的串行设备。 您必须阅读设备的 OEM 规格,并查看设备是否需要握手以及是否需要对 RTS 或 DTR 进行任何特殊处理。
Whether or not hardware handshaking is required is based solely on the serial device you're attaching to. You would have to read the OEM specs for the device and see if the device needs handshaking and if it needs any special handling of RTS or DTR.