1

I am setting up a communication with several devices via a COM port.

For the sake of presence check, I would like to implement that a present device can set a so-called BREAK condition on its UART TX. (A break condition is a condition where the sender sets its TX to low for more than 8 bits.)

But how can I detect this condition on the PC side under Windows? I have found some functions to set a break condition, or to send a timed break, but not for detecting one.

glglgl
  • 89,107
  • 13
  • 149
  • 217

1 Answers1

3

A break is an interrupt kind of event, it should only be used to reset communication in progress. So you'll get it from WaitCommEvent, EV_BREAK event bit.

Favor the handshake signals for a "presence" test. GetCommModemStatus, MS_DSR_ON tells you that the device is powered-up, MS_CTS_ON tells you that it is willing to receive data.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Due to lack of wires, I neither have DSR nor CTS... But the EV_BREAK stuff might help me, thanks! – glglgl Oct 23 '12 at 12:23