Microsoft KB Archive/63597

Description of Serial Port Transmission and Break Signals

PSS ID Number: Q63597 Article last modified on 06-12-1996

1.00 1.05 2.00

MS-DOS

= SUMMARY =

This article describes how characters are sent through the serial port, what a communications break signal is, and what it is used for.

= MORE INFORMATION =

When the serial port sends characters over the RS-232 lines, it sends the start bit, the binary representation of the character, the parity bit (if used), then the stop bit or bits.

For example, to send the character “E” at 7 data bits, 1 stop bit and even parity, it will begin by sending a start bit, which is a binary 0 (zero).

Then, it will send the binary representation of the character “E” in reverse order (least significant bit – bit 0 – first). The purpose of sending the bits in reverse order is that the serial port can send characters with 5, 6, 7, or 8 data bits. Bit 7 doesn’t always exist, but bit 0 always does. Therefore, the serial port begins by sending the least significant bit (bit 0) first, and the most significant bit last. In the example, the letter “E” is 1000101 in binary. Therefore, the bits 1010001 will be sent from the serial port.

Then a parity bit is sent. In our example, the serial port is using even parity. The serial port will force the number of “on” bits to an even number. Since the count of “on” bits is odd (1000101 = 3 bits are on), the parity bit will be on (1) to make the count of on bits even. If odd parity is being used, the parity bit will be off (0). If “mark” parity is being used, the parity bit is always on (1). If “space” parity is being used, the parity bit is always off (0). When the serial port is set to a parity of “none,” no parity bit is sent.

Finally, the stop bit or bits (binary 1) are sent. If the communications settings are for 5 data bits and 2 stop bits, 1.5 stop bits will be sent instead of 2 stop bits.

During the time that no characters are being sent (sometimes called “idling”), the line is left in an “on” (binary 1) state.

The Break Signal
When the computer sends a break signal through the serial port, it does not send a specific “break” character. Instead, it forces the serial port line to a binary 0 state for a certain length of time. Because the break signal is not a character, the sending computer must determine how long to send the signal. 150 milliseconds (.15 seconds) is usually the minimum. The break signal Works sends is 350 milliseconds (.35 seconds), which is adequate for most systems. Unfortunately, however, Works’ break signal length is hard coded and cannot be changed.

The break signal alerts the remote computer that something out of the ordinary is occurring. However, it is up to that remote computer to determine what to do upon receiving a break signal. Some computers may ignore the break signal. Some will stop the currently running program and return to a system level prompt. Others will drop the connection, especially if the break signal is long.

If the serial port rapidly sends multiple break signals, the signals may be interpreted as one long break signal, and the remote computer will be more likely to drop the connection.

An alternative to using a break signal is to try using the CTRL+C or CTRL+X key combination. Many systems will respond to these characters by interrupting the currently running process.

For additional information on serial ports and modems, see “Article 6: Interrupt-Driven Communications” on Page 167 of the “MS-DOS Encyclopedia.”

KBCategory: kbother KBSubcategory: dworkskb Additional reference words:

=
================================================================ Copyright Microsoft Corporation 1996.