Sources
- Lecture slides and lecture videos
To Review
- Line Coding Lecture
- Line Coding Slides
- Line Coding Lecture 2
- Serial Communications Lecture 1
- Serial Communications Lecture 2
- Serial Communications Slides
Line Coding
Line coding (or Pulse Modulation) refers to the process of converting binary data into digital signals (physical waveforms) for baseband transmission. The pulse units present in the signal is called a symbol.
Properties of Line Coding
- Signal/Data Level
- Signal level describes the number of possible values a signal can have. On the other hand, data level describes the number of values used to represent data.
- Pulse/Modulation/Symbol Rate
- Pulse rate indicates the number of pulse/symbols per second. Note that it is possible to have no pulse for certain segments of data.
- The number of signal elements per data element vary for different types of line coding schemes.
-
- : is the signal elements
- : is the data elements
- the ratio of the number of data elements over the number of signal elements (i.e., )
- Average signal rate
- baud
- : case factor (Forouzan),
- baud
- Spectrum
- Desirable characteristics
- Lack of high frequency components because it can reduce the bandwidth requirement
- Lack of a DC component because it allows the use of transformers and capacitors for coupling
- Concentration of power at the center of the bandwidth
- Power Spectral Density (PSD) - distribution of the signal’s power over frequency
-
- is the PSD
- is the Fourier transform of the signal
-
- Desirable characteristics
- Clocking
- Clocking is the synchronization of the transmitter and receiver clocks to distinguish bits/symbols from one another.1
- Self-clocking code is preferred over using a separate clock line due to the bandwidth it ensues. Line coding can mitigate this problem by embedding the clock information into the transmitted signal so that the receiver can deduce the clock (e.g., Manchester).
- The inability of the receiver to distinguish the starting and ending bit gives rise to the need for clocking.
- A clock is necessary when the fastest transmission speed is desired.
- Reading the data happens at the negative edge or the center of the bit interval
- Error Correction
- Some line coding schemes can allow for error detection and correction.
- For example, an error is detected when there are successive repetition of the same polarities (i.e., a positive after a positive, or a negative after a negative) when the line coding scheme is supposed to generate signals that alternate between two polarities.
- The capacity to detect/correct errors in line coding is usually not required because transmission systems typically already employ a block that is responsible for error correction/detection.
- Some line coding schemes can allow for error detection and correction.
- Noise Immunity
- Noise and other impairment sources can mix with the signal during transmission. As a consequence, it alters the some properties of the signal being received.
- Noise Immunity is the ability of the receiver to resist errors. The stronger the signal is relative to the noise (in terms of amplitude), the better the resistance.
- The signal’s strength in comparison to the noise is measured through the Signal to Noise Ratio (SNR).
- Misinterpreting noise as either high or low is prevented by using a threshold.
- For example, if noise is below a specified high threshold, it will always be classified as low and therefore prevent misinterpretation.
- The greater the signal levels, the lesser the SNR; hence, the weaker the noise immunity and noise tolerance. This is because it reduces the differences between each level.
- A lower SNR means both lower speed and lower noise immunity.
- Cost and Complexity
- Despite providing a myriad of advantages, complex line coding schemes also cost more than simpler ones. For this reason, it is important to select the most cost-effective line coding scheme that also meets your needs.
Line Coding Schemes
- Unipolar, Polar, or Bipolar
- unipolar - zero or positive/negative
- polar - two polarities(one positive, one negative)
- bipolar - two polarities and zero
- NRZ, RZ, Phase encoded or Multilevel binary
- NRZ - two levels
- RZ - three levels
- Phase-encoded - uses phase inversion
- Multilevel Binary - often combines the other features but uses more than three levels
Non-Return-To-Zero (Level)
Although it is used in magnetic recording, it is still not primarily used in signal transmission.
Pros | Cons |
---|---|
Easy to develop | DC component exists |
Makes proper use of bandwidth | Cannot synchronize on its own |
NRZ-L
- The most basic type of encoding, which is most commonly implemented in shift registers and digital logic systems.
- Two different voltage for 1 and 0 bits but does not have a voltage for 0 and does not transition between values, hence it does not return to zero.
- It is a polar type of line coding scheme.
- A polar is used over a unipolar one because a unipolar leads to a nonzero average DC voltage, which is undesirable because DC signals cannot pass through some communication circuits.
- Moreover, DC signals do not contain any information (so they are essentially useless) and they increase power consumption.
- Polar minimizes the amount of DC signals that flow through the transmission system because the positive and negative polarities can cancel each other.
Disadvantage
Without a reference clock, the receiver will not be able to discern the interval of the received signal. Consequently, it will not know how many 1 bits or 0 bits are repeated.
NRZ-M or NRZ-I
- One data is indicated by a change in level at the start of the bit interval (transition). In this regard, a zero data is indicated by no signal transition.2
- Inverting the values of NRZ-M gives the NRZ-I
- Mainly applied in magnetic recording
NRZ-S
- A zero is indicated by a transition and a one is indicated by no transition
Return-to-Zero
Pros | Cons |
---|---|
Can possibly give self-clocking ability (if Bipolar) | Higher bandwidth due to transitions |
Still have DC level issues |
Unipolar RZ
- A half-width pulse represents one
- The absence of pulse represents zero
- Used in both baseband transmission and magnetic recording
Bipolar RZ
- For one, the first half bit is positive, the latter half bit returns to 0.
- For zero, the first half bit is negative, the latter half bit returns to 0.
- Used in both baseband transmission and magnetic recording
- A self-clocking type of coding mechanism because it can allow the receiver to lock in the phase and frequency
Multi-Level Encoding
Pros | Cons |
---|---|
Eliminates the DC level by alternating polarities without the bandwidth costs associated with RZ coding techniques (because of the reduced transitions). | No self-clocking capability |
Does not loss synchronization when given a long string | Not as efficient as NRZ |
Has error detection capability | Each signal elements only represent one bit |
Needs to distinguish between three levels (+A, - A, 0) | |
Needs an estimate of 3 dB more signal power for the same probability of bit error |
Bipolar Alternate Mark Inversion (AMI)
- No line signal indicates a zero
- A positive or negative pulse indicate a one. These pulses alternate in polarity.
Pseudoternary
- Same as bipolar but the roles of one and zero is swapped: zero is indicated by positive/negative pulses, one is indicated by a no line signal.
Scrambling Techniques for B-AMI
- Scrambling replaces sequences that generate constant voltage
- Filling sequence
- Must produce enough transitions for synchronization
- Recognizable to the receiver and must be replaced with the original
- Same length as original
- Benefits:
- No DC component
- No long sequences of zero line signals
- No reduction in data rate
- Error detection capability
- Bipolar with 8 Zero Substitutions (B8ZS)
- a variant of BnZS techniques
- Replace 8 zeroes with the pattern 000VB00V, where V means bit violation and B means valid bit (in reference to the preceding pulse polarity).
- Although it causes two AMI code violations, violations are unlikely to happen due to noise, and therefore can be used for error detection
- Receiver interprets the replaced sequences as 8 zeroes
- HDB3 (high-density bipolar-3-zeros)
- String of 4 zeroes are replaced with one or two pulses
- In reference to the preceding pulse polarity and the number of bipolar ones since last substitution, replace 4 zeroes
- if odd: 000V
- if even: B00V
MLT-3
- Zero bits don’t transition
- One bit transitions in the following sequence: 1 → 0 → -1 → 0 → 1 → …
- Pros
- Lower bandwidth requirement
- Cons
- Still has issues with long sequences of zeroes
2B1Q
- Uses four signaling levels, whereby each level represents two bits
- Level ranking
- 10
- 11
- 01
- 00
Phase Encoding
Bi-Phase L
- One bit is a half-wide pulse at the first half of the bit interval
- Zero bit is a half-wide pulse at the second half of the bit interval
- Manchester coding reverses how one bit and zero bit is encoded
- Pros
- Average is 0 so no DC component
- Easier syncing for receiver
- Cons
- A lot of transitions therefore higher spectral requirement and bandwidth
Bi-Phase M
- A transition occurs at the start of every bit interval
- One bit always transitions a second time after the half bit, whereas a zero bit does not
- Overall lesser transitions
- If successive zero, transition at the start of the bit interval
Bi-Phase S
- Similar to bi-phase M except zero is the one that has a second transition while one remains the same after the first transition
- If successive one, transition at the start of the bit interval
Delay Modulation (miller codes)
- One bit transitions at a half-bit
- Zero bit does not transition at the half-bit
- Pros
- Lesser transitions than bi-phase
- Reduced bandwidth requirement
Block Coding
- Involves grouping a sequence of bits into bits and substituting bit codes for each before using a line coding mechanism
- Common block codes
- 4B/5B
- 8B/10B
- 8B/6T
- 5B/6B
- Made to improve line coding performance:
- Gives more transitions for synchronization purposes
- Gives bit patterns for minimizing DC components
- Gives error detection capability
Serial Communications
- In comparison to parallel
- Although it is slower, it does not struggle with synchronizing multiple lines
- Realistically, each line in parallel have varying delays and velocity, thereby making synchronization more elusive\
- Increasing bit rate makes the effects of delay more severe. For this reason, it is recommended to only use parallel at lower bit rate applications.
- It is more cost-effective
- Although it is slower, it does not struggle with synchronizing multiple lines
- Sending one byte will requiring serializing the one byte through a parallel to serial converter
- Challenges
- Distinguishing one bit from another, which will require clock synchronization
- A separate clock line is only practical for shorter distances
- Distinguishing which bit (related to framing)
- Distinguishing one bit from another, which will require clock synchronization
Asynchronous Vs Synchronous
- Asynchronous have different clocks for the transmitter and receiver
- Although is slower than synchronous, it is also easier and cheaper to implement and is still widely used for a myriad of applications (e.g., UART in Arduino)
- Synchronous requires the transmitter and receiver to have synchronized clocks to enhance efficiency and allow the transmission of continuous blocks of data
- A synchronized clock will have the the signal rise at the same exact time at the clock cycle for both the transmitter side and the receiver side. Only very small discrepancy is acceptable.
- Involves continuous stream of bits that are divided by bit intervals
Asynchronous Transmission
Format the data is sent in: Start bit(s), Data bits/Parity bit, Stop bit(s)
- The start bit indicates the start of the data and an active transmission. This goes low.
- Data bits are often 8 bits but can also vary.
- Parity bit indicates the parity of the data bits (i.e., if the number of bits is even or odd). It comes after the data bit and is optional.
- Stop bit, can be 1 or 2 bits. It is used to ensure that the signal returns to the idle level (high)
- Start and stop bit provides the framing—something which is used to identify the grouping of data.
- There is no regularity, meaningful data bits to be read is determined through start and stop bits.
- Corruption of framing bits (i.e., start/stop bit) will lead to misinterpretation of data
- Auto-baud
- Auto-baud can allow the receiver to sense the input data rate
- It will require that the transmitter to also support auto-baud so that the receiver can synchronize its transmission rate to the transmitter
- Without auto-baud, various parameters such as baud-rate, if there’s parity bit and if the parity bit is even or odd, etc., must be pre-defined though software
- Timing considerations
- Receiver must set sampling periods where it will read the input line. Ideally this is at the center of the bit interval.
- It determines the middle of the bit interval by monitoring the leading edge of the start bit and setting a delay of 1/2 bit interval then a bit interval for the subsequent bit readings
- Reading at the middle ensures that the reading is most likely correct
- If receiving clock is too slow, misreading may occur
- A workaround is to set the receiver clock to be several times faster than the baud rate. The ratio between the transmitter and receiver master clock is called the clocking factor (usually 16)
UART
- Universal Asynchrnous Receiver/Transmitter (UART)
- handles all functions to send and receive data
- What it does for transmission:
- Set baud rate
- Receive character bits in parallel from host device
- Generates start bit and ends transmission with stop bit
- Adds data bits in a serial group
- Determines parity and adds parity bit (if required)
- Informs host device if ready for next character
- Coordinates handshaking if required
- What it does for reception:
- Set baud rate for receiver
- Recognize start and stop bit
- Read data bits in serial group
- Reads parity bit and checks parity
- Transfers the character as a parallel group to the host
- Coordinates handshaking if required
- Error detection and flags the error bit in the status register
- Interface standards describe how Data Communications Equipment (DCE) interconnects with Data Terminal Equipment (DTE)
RS232
- A standard issued in 1962 for describing the interconnection between a DTE and DCE
- Mechanical specs - mechanical details like pin assignments or connectors
- Functional specs - describe the functions of each pin
- Electrical pins - provides electrical characteristics and semantics
- RS232 line driver transceiver output amplifies the signal to make it more noise tolerant
- Procedural specs - provides for things like sequences or state transitions
RS 422
- 10 devices can be connected but master can connect to one slave at a time
RS 485
- Better version of RS 422 in that it allows any two device of up to 32 multiple device to communicate with one another, with either being able to be a slave or master
RS 422 and RS 485
- Supports full-duplex connection in that it is not limited to a single TX and RX (it has a pair like TX- and TX+ to make them more independent from the ground as reference and minimize noise)
- Transceivers allows switching between the two sets (TX and RX) so that information can be transmitted from the TX of one device to the RX of the other device
Additional Information
- UART - is a protocol used by Arduino to communicate with another Arduino or with other peripheral devices.
- It requires two signal lines: RX and TX.
- For a bidirectional system, the TX of the transmitter side should direct its signal to the RX of the receiver side. Similarly, the receiver side’s TX should also be directed to the RX of the transmitter side.
- For a unidirectional system, there should only be a TX at the transmitter side, which is connected to the RX of the receiver side.
- It does not have a separate clock signal, instead it tries to read the incoming signal by knowing the transmitter clock’s frequency beforehand. Nonetheless, errors exist because UART just ignores the incorrect phase relationship between their clocks. Additionally, the speed of transmission is restricted by the unsynchronized clocks.
- Can be coupled with a standard known as RS232C. Usually a computer has a serial port that can act as a DB9 connector and relies on the RS232C.
- RS232 translates the voltage level of the UART
- It requires two signal lines: RX and TX.
- Channel is the virtual version of a physical medium
- Fastest computer data transmission speed is not built in, you need to add it through SCSI. Though these interfaces, particularly parallel, has been superseded by USB (which uses serial technology) .
- 4 lines of the USB
- VCC
- D+
- D-
- GND
- 4 lines of the USB
- Idle line means that the voltage level is high
- Handshaking ensures that there is coordination between DCE and DTE so that DCE won’t be overwhelmed