This article was previously published under Q119506
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
A BREAK signal is a communications signal that allows two communicationsdevices to transmit a "break" in the transmission line. This articlediscusses how a communications program implemented using the MicrosoftWindows Communications API (Comm API) can send a BREAK signal.
Despite its name, a BREAK signal may be employed to convey just about anyspecial condition as long as the sender and the receiver know the semanticsof the signal. A BREAK signal, sometimes mistakenly referred to as a BREAKcharacter, is any SPACE condition on the communication line that lastslonger than a character and its framing bits.
Comm API contains two functions, SetCommBreak() and ClearCommBreak(), toassist in sending a BREAK signal. Merely calling these two functions insequence will not cause a BREAK signal to be sent. Use one of the twomethods described below to transmit the BREAK signal:
The International Consultative Committee for Telephone and Telegraph(CCITT) modem recommendations require a break signal to be at least "2m+3"bits long, where "m" is the nominal number of bit times in an asynchronouscharacter, usually 10; this means that the minimum break time is 23 bits,with no maximum specified. Usually, much more than the minimum is sent,such as 100 or 200 milliseconds (that is, hundreds of bit times at highdata rates). The timer resolution in a PC is sufficient for sending such"long" BREAK signals, but not sufficient to send exactly 23 bit times.
An application can call SetCommBreak() to initiate the BREAK signal. UseSetTimer() to set a timer and wait for the recommended duration, and thencall ClearCommBreak() to terminate the BREAK signal.
NOTE: If an application sends some data and subsequently callsSetCommBreak() before that data has had a chance to make its way throughthe transmit first in, first out algorithm (FIFO), the data will actuallybe overwritten by the SetCommBreak() and not get onto the line. To preventsuch corruption, it is recommended that you pause for a while before theSetCommBreak().
An alternative means of sending a BREAK signal of shorter duration is totemporarily change the data rate in the UART to half or 1/4 of the actualline speed and then send a single NULL byte. This is more precise thanusing SetCommBreak() and ClearCommBreak(), but it has the disadvantage ofcorrupting received data during the time the BREAK signal is being sent(because the received data rate is wrong during that time). An applicationcan change the date rate in the UART with a call to SetCommState(). The DCBstructure passed to SetCommState() specifies the new data rate.
For more information on the BREAK signal and the SPACE character, pleaserefer to "C Programmer's Guide to Serial Communications," second edition,by Joe Campbell, published by SAMS Publishing.