开发者

Raising or lowering RTS on serial port (C++)

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_开发者_JS百科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.


Take a look at EscapeCommFunction.

EscapeCommFunction(hPort, SETRTS);

The hardware handshaking must be disabled, i.e. dcb.fRtsControl should be set to something other than RTS_CONTROL_HANDSHAKE when calling SetCommState.


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.


In .Net it is the .RtsEnable property of the serialport.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜