Line code
Adapted from Wikipedia · Adventurer 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 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 moves through a physical channel, like a transmission medium or data storage medium. Common channels include transmission lines, where changes in voltage or current carry the signal. The signal can also be changed 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 chosen 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 send a steady signal well. This steady signal is called the DC component. We also call it disparity or bias.
The disparity of a bit pattern is the difference between the number of one bits and zero bits. To stop errors, most line codes are made to remove this DC component. These codes are called DC-balanced, zero-DC, or DC-free.
There are three main ways to remove 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. This helps stop constant electrical current, which is good for signals going through transformers or long wires.
But some long-distance channels have polarity ambiguity. This means they can't tell the difference between positive and negative signals.
There are three ways to fix this:
- Pair each code word with its opposite. The receiver can understand either version. Examples include alternate mark inversion, Differential Manchester encoding, coded mark inversion and Miller encoding.
- Use differential coding. Here, each symbol is compared to the one before it. Examples are MLT-3 encoding and NRZI.
- Invert the whole stream when special syncwords are found. This can use polarity switching.
Run-length limited codes
To help a device know the time while reading data, we limit how many same bits (like 0s or 1s) can come together. This helps the device know where each bit starts and ends, so it does not make mistakes.
Different types of these codes are used in technology. Old computers used simple codes. As storage improved, better codes were made. These codes help store more data in less space and keep it easy to read.
Synchronization
Main article: Clock recovery
Line coding helps the receiver match the timing of the sent signal. If the timing isn’t right, it can be harder to understand the data and mistakes can happen.
Some line codes, like biphase, change at least once for every bit sent. This makes it easier to keep timing correct and find mistakes. But it also needs more space to send the same amount of information as other codes.
Other considerations
A line code is made to work well with different ways of sending signals, like optical fiber or shielded twisted pair. Each type acts in its own way because of things like interference, distortion, capacitance, and attenuation. These factors change how signals are sent and received.
Common line codes
Line codes are special patterns used to send digital data over wires, air, or 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 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