Electronic – Start bits in asynchronous serial communications

serialuart

I understand synchronous serial communication conceptually but I'm having trouble with how asynchronous works. Specifically in this situation:

Let's say I want to send a byte: 0x03. We have a start and stop bit, which are low and high, respectively. How does the receiving device "know" that I'm sending a start bit followed by 6 0s? How does it know that that isn't just one long start bit?

Followup: what exactly is a UART? I'm asking what the common use is, as I've seen various places refer to it as a standard and others as a piece of hardware.

Best Answer

How does the receiving device "know" that I'm sending a start bit followed by 6 0s? How does it know that that isn't just one long start bit?

Because with this kind of communication, both the sender and receiver have to agree ahead of time on a few parameters. The two key parameters here are the baud rate and the number of data bits.

The line starts out in the idle level. The transmitter first sends the start bit, which is at the opposite level. It then sends the data bits, followed by the stop bit.

Unlike what others have said, the stop bit is not a checksum. It is required so that there is always a transition at the leading edge of the start bit. Otherwise, if the last data bit ov the previous character happened to be of the same polarity as a start bit, the receiver wouldn't be able to see the start bit if a new character was sent immediately. The stop bit is essentially enforced line idle time between characters. That time is also used to absorb some clock mismatch between the sender and receiver.

When idle, the receiver monitors the line looking for it to change to the non-idle state. When that happens, it starts a stopwatch. Since it is configured for the same bit rate as the transmitter, it knows when each data bit is sent, whether it differs from a previous bit or not. The middle of the first data bit is at 1½ bit times from the leading edge of the start bit. The second at 2½ bit times, etc.

After the last data bit is received, the receiver waits for the line to go back to the idle state, then waits for the next start bit again.

A UART is a device that does all this transmit and receive timing for you. You configure the UART for the baud rate you will use, the number of data bits, and a few other parameters. After that, you usually just give it full bytes and it takes care of chugging out the bits. For receiving, it detects the start bit, does the timing, grabs the bits, and gives you a byte on a silver platter, often with some additional optional status information.