RTS_CONTROL_TOGGLE and the SerialPort class

H

Henrik [7182]

Hello Friends,

I need to control a serial port that is hooked to a RS485 tranceiver.
Therefore I need to control the fRtsControl member of the underlying DCB
structure for a serial port in order to have the hardware RTS-line toggled
in accordance with the state of my writebuffer.

However, I see no way of doing this with the SerialPort class. Is this not
possible? And if not, why has this been removed?

I thought about using the RTSEnable property something like this, eventhough
it wouldn't be pretty:

port.RtsEnable = true;
port.Write(buffer, 0, byteCount);
WaitForTxBufferEmpty(port);
port.RtsEnable = false;

but I cannot find a way for raising the event I need from the buffer. And if
it was possible to set the aforementioned flag, I would not even have to
think about it.

Is there a clever way around this problem, so that I can use the exsting
..NET SerialPort class or do I have to roll my own, using the old Win32
APS's?

Thanking you in advance for any answers

Best regards
Henrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top