I'm writing a Win32 Application that suppose to communicate
with an external device via Serial port (COM port).
I want to use the Serial port RTS Pin for flow control
(RTS=ON - PC Transmitting now, RTS=OFF - PC Receiving now).
I have set the DCB's "fRtsControl" to "RTS_CONTROL_TOGGLE",
so (according to the "Help" section):
"RTS line will be high if bytes are available for
transmission. After all buffered bytes have been sent,
the RTS line will be low."
Unfortunately, the result is that the RTS pin goes HIGH
right after the "SetCommState" command, and stays high even
if there are no buffered bytes to transmit.
I'm using BC5.01A, on Windows95, and here is the code I use
to open the serial port:
hCom=CreateFile("COM2",GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, 0, NULL);
BuildCommDCB("baud=9600 parity=N data=8 stop=1",&dcb);
Could anyone tell me what is wrong ?