Section 23.2
Serial transmission and data signaling

Almost all data communication between separate computers is done through serial buses or wires. Over a serial bus a computer sends bytes or other units of data one bit at a time. This is in contradistinction to parallel buses which are faster but more expensive, and which can transmit entire bytes or larger units in one time unit due to having more data wires. In fact, one of the ways of distinguishing between a computer and a network is that the former tends to use parallel buses between the components while a network uses serial buses (although some peripheral buses such as Apple's ADB are serial).

Here are some of the more popular cable types used to transmit bits between computers:

Since wires always seem to have either 1s or 0s on them (they either have a high voltage or a low voltage, or no-light or some-light in the case of fiber optics) it is hard to say exactly when a packet starts. Synchronization is needed to enable the sender and receiver to agree on the bit boundaries and they also need to agree on a common bit rate in order to set their clocks accurately. Then, even tick of their internal clock, they sense the communication's wires voltage (or light amplitude) and register either a 1 or a 0. These are often difficult and complicated issues which we can only hint at here.

Some signaling techniques are easier for the receiving circuitry to sense than others. One technique is called NRZL (Non-Return to Zero, Level) which encodes 1s and 0s in a fashion that seems very obvious. Fig. 23.2.1 shows a data byte transmitted in this fashion. 0 is encoded as a certain voltage level, say +5 Volts, while 1 is encoded as a higher voltage level, such as +12 V. 01001110 is encoded as a sequence of these voltage levels. The sharp transitions from 5 to 12 and back down are actually simplifications because voltage cannot rise infinitely swiftly, but for our purposes the rise is fast enough relative to the "bit width" that it appears to be a sharp square wave.


Fig. 23.2.1: NRZL encoding of 01001110

The trouble with this method, simple as it seems, is that long sequences of all 1s or all 0s will cause the voltage to be constant. Since no two physical clocks will ever stay perfectly in synch forever, but will tend to drift, they may lose track of where the bit boundaries are and thus get off. Every transition, however, allows the receiver to determine where the bit boundary should be so it can reset itself appropriately. Fig. 23.2.2 shows how a receiver with a slightly fast clock can get off and think there are more bits than were really sent by the sender. This effect is exaggerated; real clocks may take thousands of clock cycles to get out of synch.


Fig. 23.2.2: Out of synch clocks misinterpreting a string of 1s
Nine data bits are sent in 8 time periods

NRZI (Non-return to Zero, Inverted) is an encoding method that seeks to put more transitions into the bit stream. A 1 is encoded by a transition from the present voltage, either down if it is already up or up if it is presently down. Thus a string of 1s will look like a bunch of transitions, although a sequence of 0s will still look like the same voltage level hanging on indefinitely. Fig. 23.2.3 shows an NRZI encoding of 01001110.


Fig. 23.2.3: NRZI Encoding of 01001110

Another benefit of NRZI is that the bit stream being sent is still decipherable even if the polarity is reversed! This means that if +12 V suddenly becomes 0 and +5 V becomes 1, the exact stream of 1's and 0's is the same as before, because it is only the presence or absence of transitions that signifies a 1 or a 0. Polarity reversals can happen if wires are hooked up wrong.

In order to force a transition from 1 to 0 on a regular basis, a technique called bit stuffing is used. The transmitting circuitry, being fed a stream of bits from the processor, counts the number of 1s or 0s in a row and if there are too many, it inserts the opposite. In Fig. 23.2.4 we see a bit stuffing mechanism where 5 1's are always followed by a 0. The receiver counts the number of 1s and if there are 5, it removes the following 0.


Fig. 23.2.4: Bit stuffing

There are other methods of encoding bit streams that force regular transitions in voltage level, such as Manchester encoding. In Manchester, there is always a transition in the center of the bit time. If the data bit is a 0, then transition is from high to low voltage, while 1 is from low to high voltage. Fig. 23.2.5 shows the Manchester encoding of 01001110. There is also a differential Manchester, like NRZI, where the polarity can be differential Manchester reversed without destroying the bit stream.


Fig. 23.2.5: Manchester encoding of 01001110