提高或降低串行端口上的 RTS (C++)
我有一段代码可以读取串行端口 CTS 线的当前状态,然后应用程序根据那里的值进入适当的模式。
使用此处描述的空调制解调器电缆:
http://www.lammertbies。 nl/comm/info/RS-232_null_modem.html#full
我可以检测到通过零调制解调器电缆连接的其他端口上的 RTS 线路。
有没有一种方法可以程序化地提高或降低 RTS 线?
平台是 Win32、C++,但任何有关 RTS 线路何时升高或降低的信息都会有所帮助。
I have a piece of code that can read current state of serial port CTS line, and application then goes into appropriate mode bases on value there.
Using null-modem cable described here:
http://www.lammertbies.nl/comm/info/RS-232_null_modem.html#full
i can detect RTS line on some other port that is connected via that null-modem cable.
Is there a way of programmatic raising or lowering RTS line?
Platform is Win32, c++, but any info on when is RTS line raised or lowered would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看看
EscapeCommFunction
< /a>.必须禁用硬件握手,即在调用
SetCommState
。Take a look at
EscapeCommFunction
.The hardware handshaking must be disabled, i.e.
dcb.fRtsControl
should be set to something other thanRTS_CONTROL_HANDSHAKE
when callingSetCommState
.这个问题高度依赖于特定的平台,而不仅仅是操作系统。如果 RTS 线作为输出连接到机器,则可以将其提升。
最低级别的硬件必须提供对线路的访问。某些串行接口不允许软件访问该线路,但会通过硬件握手自动处理它。
操作系统必须允许用户应用程序访问此资源。在某些操作系统中,串行端口可能仅限于内核或超级用户权限。
This issue is highly dependent on the specific platform, not just OS. If the
RTS
line is connect to the machine as an output, then it can be raised.The lowest level hardware must provide access to the line. Some serial interfaces don't allow software access to this line, but handle it automatically through H/W handshaking.
The operating system must allow access to this resource to the user application. In some OSes, the serial port may be restricted to Kernel or super-user privilege.
在 .Net 中,它是串行端口的 .RtsEnable 属性。
In .Net it is the .RtsEnable property of the serialport.