Toggling the CD (RLSD) signal line on a serial port in Windows C
I am trying to set the Carrier Detect (Receive Line Signal Detect) pin on a serial port being co开发者_运维百科ntrolled by my Windows application. I am already able to set the RTS line high using this function:
EscapeCommFunction(handle, SETRTS);
and then subsequently clear it by using:
EscapeCommFunction(handle, CLRRTS);
I want to be able to do this exact same thing with the CD line, but no such SET/CLR flags exist for the EscapeCommFunction.
The PC serial port was designed from the viewpoint of a terminal, not a modem. The CD signal is an output from a modem and an input to a terminal. Even if the port hardware allows you to change the direction (of which I'm skeptical) the standard interface would not be programmed that way.
RS232 devices can be either a DTE (Data Terminal Equipment) or DCE (Data Communications Equipment). Examples of DCEs are modems, multiplexors and some line drivers (technically a modem), everything else including your computer is a DTE.
The DCD (RLSD) is an output from a DCE to indicate that has detected the carrier on the comms link i.e. can see the remote modem.
I know of no way to convert a DTE into a DCE with a standard serial port.
精彩评论