Line code
Adapted from Wikipedia · Discoverer experience
In telecommunications, a line code is a special pattern of signals, such as changes in voltage, current, or light, that represents digital data. These patterns are used when sending information through a communication channel or storing it on a storage medium. Because of the physical limits of how data can travel or be stored, only certain signals can be used reliably without errors.
Different types of line codes are used for different purposes. Some of the most common line encodings include unipolar, polar, bipolar, and Manchester code. Each type has its own way of turning binary information—sequences of zeros and ones—into signals that can be sent over long distances or saved for later use. Understanding line codes helps engineers design better ways to send data quickly and accurately across phones, computers, and many other devices we use every day.
Transmission and storage
After line coding, the signal travels through a physical channel, like a transmission medium or data storage medium. Common channels include transmission lines, where voltage or current changes carry the signal. The signal can also be shaped and modulated to create an RF signal for wireless transmission, or used in free-space optical communication like infrared remote controls. It can be printed as a bar code, stored as magnetized spots on a hard drive or tape drive, or as pits on an optical disc.
Line codes are selected based on several goals: reducing hardware needs, helping devices stay in sync, making errors easier to find and fix, reaching a certain spectral density, and avoiding a DC component. Each type of line code has its own strengths and weaknesses.
| Signal | Comments | 1 state | 0 state |
|---|---|---|---|
| NRZ–L | Non-return-to-zero level. This is the standard positive logic signal format used in digital circuits. | forces a high level | forces a low level |
| NRZ–M | Non-return-to-zero mark | forces a transition | does nothing (keeps sending the previous level) |
| NRZ–S | Non-return-to-zero space | does nothing (keeps sending the previous level) | forces a transition |
| RZ | Return to zero | goes high for half the bit period and returns to low | stays low for the entire period |
| Biphase–L | Manchester. Two consecutive bits of the same type force a transition at the beginning of a bit period. | forces a negative transition in the middle of the bit | forces a positive transition in the middle of the bit |
| Biphase–M | Variant of Differential Manchester. There is always a transition halfway between the conditioned transitions. | forces a transition | keeps level constant |
| Biphase–S | Differential Manchester used in Token Ring. There is always a transition halfway between the conditioned transitions. | keeps level constant | forces a transition |
| Differential Manchester (Alternative) | Need a Clock, always a transition in the middle of the clock period | is represented by no transition. | is represented by a transition at the beginning of the clock period. |
| Bipolar | The positive and negative pulses alternate. | forces a positive or negative pulse for half the bit period | keeps a zero level during bit period |
Disparity
Most long-distance communication channels can't reliably send a steady signal, known as the DC component. This component is also called disparity or bias. The disparity of a bit pattern is the difference between the number of one bits and zero bits. To avoid errors, most line codes are designed to eliminate this DC component. These codes are called DC-balanced, zero-DC, or DC-free.
There are three main ways to eliminate the DC component. One way is to use a constant-weight code, where each code word balances positive and negative levels so the average is zero. Examples include Manchester code and Interleaved 2 of 5. Another way is to use a paired disparity code, where code words are paired to balance each other out. Examples are alternate mark inversion, 8b/10b, and 4B3T. The third way is to use a scrambler, like the one specified in RFC for 64b/66b encoding.
Polarity
Bipolar line codes use two polarities and can eliminate any constant electrical current, which is important for signals passing through transformers or long transmission lines. However, some long-distance channels have polarity ambiguity, meaning they can't tell the difference between positive and negative signals.
To solve this, there are three main methods. First, pair each code word with its opposite, so the receiver can understand either version. Examples include alternate mark inversion, Differential Manchester encoding, coded mark inversion and Miller encoding. Second, use differential coding where each symbol is compared to the previous one, like in MLT-3 encoding and NRZI. Third, invert the whole stream when special syncwords are detected, sometimes using polarity switching.
Run-length limited codes
To make sure a device can keep track of time while reading data, we limit how many identical bits (like 0s or 1s) can come one after another. This helps the device recognize where each bit starts and ends, avoiding mistakes.
Different types of these codes are used in technology. Early computers used simple codes, but as storage got better, more advanced codes were developed. These codes help store more data in less space while keeping it readable.
Synchronization
Main article: Clock recovery
Line coding helps the receiver match the timing of the sent signal. If this timing isn’t perfect, decoding the data can become harder and mistakes can happen.
Some line codes, like biphase, change at least once for every bit sent. This makes it easier to keep timing right and spot mistakes, but it also needs more space for sending the same amount of information compared to other codes.
Other considerations
A line code is designed to meet the needs of the transmission medium, such as optical fiber or shielded twisted pair. Each type of medium behaves differently due to factors like interference, distortion, capacitance, and attenuation, which affect how signals are sent and received.
Common line codes
Line codes are special patterns used to send digital data over wires, air, or even in DVDs and CDs. Some common line codes include 2B1Q, 4B3T, 4B5B, 6b/8b encoding, and 8b/10b encoding. These codes help turn data into signals that can travel safely and be understood correctly by devices.
Other line codes like EFMPlus for DVDs, Eight-to-fourteen modulation for compact discs, and Manchester code are also used in different technologies. Optical line codes, used for light-based communication, include Alternate-Phase Return-to-Zero and Carrier-Suppressed Return-to-Zero.
This article is a child-friendly adaptation of the Wikipedia article on Line code, available under CC BY-SA 4.0.
Safekipedia