Document Sample
ALGORITHM Powered By Docstoc
					  Chapter 5
Data Encoding

Information: Numeric Data,
characters, voice, pictures,
codes or any massage that can
be read by and has meaning to
human and machine.
• For transmission:
  – Information must be converted into binary
     • ASCII table
     • Unicode
  – Information must be encoded into
    electromagnetic signals. (Analog or digital)
• Digital Signal:
  – A digital signal is a sequence of discrete
    discontinuous voltage pulses.

     • Each pulse is a signal element

     • In its simplest form each signal element
       represents a binary 0 or 1.
           Data Encoding
Both analog and digital information can
  be encoded as either analog or digital.
  (Function of media and communication )
• Digital data, digital signal
• Digital data, analog signal
• Analog data, digital signal
• Analog data, analog signal
   Terminology (digital signal)
• Unipolar encoding: If the signal
  elements all have the same algebraic
  signs, all positive or all negative, the
  signal is called unipolar.
• Polar encoding: One logical state is
  represented by positive voltage and the
  other by the negative voltage level.
    Terminology (digital signal)
• Data rate: The rate in bits per second that the data
  is transmitted. (R)

• Bit duration: The amount of time for one bit
  transmission (1/R)

• Modulation rate: The rate at which the signal
  level is changed. (baud rate, signal levels per
• Encoding scheme: The mapping from data bits to
  signal elements
• Spectrum: The spectrum of a signal is the range
  of frequencies that it contains.
• Absolute bandwidth: The width of the spectrum
• Effective bandwidth: The are of the bandwidth
  where most of the energy of the signal is
• DC (direct current)component: A
  component of a signal with the frequency of
• Example
  – S(t)=1+(4/)sin(2  ft) + ….
 Evaluation of Various Encoding
  Techniques (affecting factors)
• Signal spectrum:
   – Lack of high frequency components means less
     bandwidth required for transmission
   – DC component: It is desirable to have no DC
     component. (easier implementation)
• Clocking: The beginning and end of each bit
  position must be determined.
   – Providing separate clocking information.
   – Implementation of some other ways of synchronization
 Evaluation of Various Encoding
  Techniques (affecting factors)
• Error detection:
  – To detect errors more quickly, some error
    detection techniques must be built into
    signaling encoding methods.
• Signal interference and noise immunity:
  – Some signal encoding techniques provide better
    error rate (BER) than others
• Cost and complexity
            Data Encoding
Digital data, analog signal

• A modem converts digital data to analog
  – Amplitude –shift keying (ASK)
  – Frequency –shift keying (FSK)
  – Phase –shift keying (PSK)
            Data Encoding
Analog data, Digital signals
• Pulse code modulation (PCM)

  – Samples analog data periodically
  – Quantizing (limiting the possible values to
    discrete set of values) the samples
            Data Encoding
Digital data, digital signal

• Simplest form of digital encoding

  – Two voltage level required
  – It can be enhanced to improve performance.
   Digital–to-Digital Encoding
• Unipolar
  – Uses only one level of voltage
    (almost obsolete)
• Polar
  – Uses two level of voltage
• Bipolar
  – Uses theree level of voltage
        Unipolar Encoding
• Presence and absence of a voltage
  level is used for two binary digits.

    • The absence of voltage could represent
    • A constant positive voltage could
      represent 1.


  0   1     0    0   0
     Unipolar Encoding Issues
• Synchronization: A major issue:
   – Example: For a bit rate of 1000 bps, the
     receiving device must measure each bit for
     0.005 s.
• DC Component:
• The average amplitude of a unipolar encoded
  signal is not zero.
  – This creates a DC component ( a component with zero
  – DC component can not travel through some media
    that can not handle DC component
        Polar Encoding

Polar encoding uses tow voltage
 levels (positive and negative)

    NRZ             RZ             Biphase

NRZ-L     NRZ-I                         Differential
  Variation of Nonreturn to Zero
NRZ-L, Nonreturn to Zero-level (polar)

• The level of the signal depends on the type of the bit it
  represents (a positive voltage usually represents bit 0 and
  negative voltage represents the bit 1 (or vice versa)

   – The problem exist when receiver needs to interpret long streams
     of 1 or zero.

Or NRZ-I (Nonreturn to Zero Invert on ones)
        Nonreturn to Zero-Level


   0        1   0   0   1    1    1      0
 Variation of Nonreturn to Zero
NRZ-I (Nonreturn to Zero Invert on ones)

• An inversion of voltage level represents a 1 bit.

• The transition between a positive and negative
  voltage represents a 1 not the voltage level itself.

• A 0 is represented by no change

• Still a string of zeros is a problem.
       Nonreturn to Zero, invert on ones


   0        1   0   0   0   1   1   1          0

        Nonreturn to Zero-Level
        Nonreturn to Zero, invert on ones

   0        1       0       0   1     1   1       0

   0        1   0       0   0   1     1       1       0
            Return to Zero
• One solution to synchronization
  issue of NRZ-L and NRZ-I is using RZ
  (Return to Zero) encoding schemes.
  – It uses three values: positive, negative
    and zero.
  – In RZ, the signal changes during each bit.
  – A 1 bit is represented by positive-to zero
    and a 0 bit by negative-to-zero.
         Return to Zero
It requires two signal changes to encode one bit.
(uses more bandwidth)

   0      1      0      0      1       1       1


    These transitions can be used for synchronization
         NRZ pros and cons
• Pros
  – Easy to engineer
  – Make good use of bandwidth
• Cons
  – dc component
  – Lack of synchronization capability
• Used for magnetic recording
• Not often used for signal transmission

    NRZ             RZ             Biphase

NRZ-L     NRZ-I                         Differential
           Biphase Encoding
• The most popular encoding to deal with the
  synchronization problem.
• The signal changes at the middle of the bit
  interval and continues to the opposite pole
  (dose not return to zero).

• Types of biphase encoding:
  – Manchester

  – Differential Manchester
           Biphase Encoding
• Manchester Encoding:
  – The inversion at the middle of each bit is
    used for both synchronization and bit

     • i.e. Transition serves as clock and data
  – Low to high represents one
  – High to low represents zero
  – Used by IEEE 802.3
Manchester Encoding

   0      1   0   0     1   1   1   0

   Zero               One
       Differential Encoding
• Data represented by changes rather
  than levels
• More reliable detection of transition
  rather than level
• In complex transmission layouts it is
  easy to lose sense of polarity
          Biphase Encoding
• Differential Manchester:
  – Transition at the middle of bit interval is
    used for clocking only.
  – Transition at the start of a bit period
    represents zero.
  – No transition at start of a bit period
    represents one.
  – Note: this is a differential encoding scheme
  – Used by IEEE 802.5.
        Differential Manchester

                0   1   0   0   1   1   1   0

Presence of transition at the beginning of the bit
interval represents zero.
Absence of transition at the beginning of the bit
interval represents one.
         Biphase Pros and Cons
• Con
  – At least one transition per bit time and
    possibly two
  – Maximum modulation rate is twice NRZ
  – Requires more bandwidth
• Pros
  – Synchronization on mid bit transition (self
  – No dc component
  – Error detection
     • Absence of expected transition
         Multilevel Binary
Use more than two levels

• Bipolar-AMI (Alternate mark inversion)

• Pseudoternary (variation of Bipolar-
          Bipolar Encoding
• Uses there voltage levels
  – Positive, negative, and zero

• Zero level represents binary 0

• One’s are represented by alternating
  positive and negative voltages
   Types of Bipolar Encoding
• Bipolar Alternate Mark Inversion

  – Bipolar 8-zero substitution (B8ZS)

  – High density bipolar 3 (HDB3)
Types of Bipolar Encoding


       Bipolar Alternate Mark
          Inversion (AMI)

• Mark comes from telegraphy (meaning 1)
• Zero voltage represents zero
• Binary 1’s are represented by alternating
  positive and negative voltages
Alternate mark inversion (AMI)

0 1 0 0 1 1 10
Bipolar-AMI and Pseudoternary
    Types of Bipolar Encoding
• Pros:
  – DC component is zero
  – A long sequence of 1’s is always
  – Lower bandwidth
  – Easy error detection
• Cons
  – No mechanism for synchronization of long string
    of zeros
            Variation of AMI
•   Bipolar 8-zero substitution (B8ZS)
•   (implemented in US)
•   High Density bipolar 3 (HDB3)
•   (implemented in Europe)

    – In both methods the original pattern is
      modified in the case of multiple
      consecutive zeros.
   Bipolar 8-zero substitution

• It works similar to BMI
• Whenever 8 or more consecutive
  zeros occurs, signal level is forced to
• One represented by absence of line
• Zero represented by alternating positive
  and negative
• No advantage or disadvantage over
 Trade Off for Multilevel Binary
• Not as efficient as NRZ
  – Each signal element only represents one bit
  – In a 3 level system could represent log23 = 1.58
  – Receiver must distinguish between three
    (+A, -A, 0)
  – Requires approx. 3dB more signal power for
    same probability of bit error
• Use scrambling to replace sequences that
  would produce constant voltage
• Filling sequence
    – Must produce enough transitions to sync
    – Must be recognized by receiver and replace with
    – Same length as original
•   No dc component
•   No long sequences of zero level line signal
•   No reduction in data rate
•   Error detection capability
• Bipolar With 8 Zeros Substitution
• Based on bipolar-AMI
• If octet of all zeros and last voltage pulse
  preceding was positive encode as 000+-0-+
• If octet of all zeros and last voltage pulse
  preceding was negative encode as 000-+0+-
• Causes two violations of AMI code
• Unlikely to occur as a result of noise
• Receiver detects and interprets as octet of all
• High Density Bipolar 3 Zeros
• Based on bipolar-AMI
• String of four zeros replaced with one or
  two pulses
B8ZS and HDB3
   Digital Data, Analog Signal
• Public telephone system
  – 300Hz to 3400Hz
  – Use modem (modulator-demodulator)
• Amplitude shift keying (ASK)
• Frequency shift keying (FSK)
• Phase shift keying (PK)
Digital to Analog Encoding
        Amplitude Shift Keying
• Values represented by different amplitudes of
• Usually, one amplitude is zero
    – i.e. presence and absence of carrier is used
•   Susceptible to sudden gain changes
•   Inefficient
•   Up to 1200bps on voice grade lines
•   Used over optical fiber
Modulation Techniques (ASK)

 s(t )  A cos(2   f       t)    Binary 1

  s(t )  0                      Binary 0
Modulation Techniques(ASK)
     Frequency Shift Keying
• Values represented by different
  frequencies (near carrier)
• Less susceptible to error than ASK
• Up to 1200bps on voice grade lines
• High frequency radio
• Even higher frequency on LANs using
Modulation Techniques (ASK)

 s(t )  A cos(2                f       t)        Binary 1

   s(t )  A cos(2                f         t)   Binary 0
f1 and f2 are offset from fc by equal but opposite amount
FSK on Voice Grade Line
Modulation Techniques(FSK)
         Phase Shift Keying
• Phase of carrier signal is shifted to
  represent data
• Differential PSK
  – Phase shifted relative to previous
    transmission rather than some reference
Modulation Techniques (PSK)
    (Differential PSK)

s(t )  A cos(2               f       t  )        Binary 1

     s(t )  A cos(2                  f       t)   Binary 0
 The phase shift is is in reference to previous bit transmitted
 Rather than to some constant reference signal.
          Quadrature PSK
• More efficient use by each signal
  element representing more than one bit
  – e.g. shifts of /2 (90o)
  – Each element represents two bits
  – Can use 8 phase angles and have more
    than one amplitude
  – 9600bps modem use 12 angles , four of
    which have two amplitudes
   Modulation Techniques (PSK)
      (Differential QPSK)

s(t )  A cos(2 f t   / 4)     Binary 11

s(t )  A cos(2 f t  3 / 4)    Binary 10

 s(t )  A cos(2 f t  5 / 4)   Binary 00

 s(t )  A cos(2 f t  7 / 4)    Binary 01
8-QAM Signal
Have a great day .
See you on Friday.
4-QAM and 8-QAM
Bandwidth for ASK
Bandwidth for FSK
Bit Rate and Baud Rate
Bit Rate and Baud Rate
Modulation Techniques(FSK)
Performance of Digital to Analog
      Modulation Schemes
• Bandwidth
  – ASK and PSK bandwidth directly related to bit rate
  – FSK bandwidth related to data rate for lower
    frequencies, but to offset of modulated frequency
    from carrier at high frequencies
  – (See Stallings for math)
• In the presence of noise, bit error rate of PSK
  and QPSK are about 3dB superior to ASK
  and FSK
    Analog Data, Digital Signal
• Digitization
   – Conversion of analog data into digital data
   – Digital data can then be transmitted using NRZ-L
   – Digital data can then be transmitted using code
     other than NRZ-L
   – Digital data can then be converted to analog
   – Analog to digital conversion done using a codec
   – Pulse code modulation
   – Delta modulation
  Pulse Code Modulation(PCM)
• If a signal is sampled at regular intervals at a
  rate higher than twice the highest signal
  frequency, the samples contain all the
  information of the original signal
   – (Proof - Stallings appendix 4A)
• Voice data limited to below 4000Hz
• Require 8000 sample per second
• Analog samples (Pulse Amplitude
  Modulation, PAM)
• Each sample assigned digital value
  Pulse Code Modulation(PCM)
• 4 bit system gives 16 levels
• Quantized
  – Quantizing error or noise
  – Approximations mean it is impossible to recover
    original exactly
• 8 bit sample gives 256 levels
• Quality comparable with analog transmission
• 8000 samples per second of 8 bits each gives
        Nonlinear Encoding
• Quantization levels not evenly spaced
• Reduces overall signal distortion
• Can also be done by companding
          Delta Modulation
• Analog input is approximated by a
  staircase function
• Move up or down one level () at each
  sample interval
• Binary behavior
  – Function moves up or down at each
    sample interval
Delta Modulation - example
Delta Modulation - Operation
Delta Modulation - Performance
• Good voice reproduction
  – PCM - 128 levels (7 bit)
  – Voice bandwidth 4khz
  – Should be 8000 x 7 = 56kbps for PCM
• Data compression can improve on this
  – e.g. Interframe coding techniques for video
   Analog Data, Analog Signals
• Why modulate analog signals?
  – Higher frequency can give more efficient
  – Permits frequency division multiplexing (chapter 8)
• Types of modulation
  – Amplitude
  – Frequency
  – Phase
              Spread Spectrum
•   Analog or digital data
•   Analog signal
•   Spread data over wide bandwidth
•   Makes jamming and interception harder
•   Frequency hoping
    – Signal broadcast over seemingly random series of
• Direct Sequence
    – Each bit is represented by multiple bits in
      transmitted signal
    – Chipping code
          Required Reading
• Stallings chapter 5
          Atmospheric and
        Extraterrestrial Noise
   –Lightning: It is a major source of noise, caused
   by the static discharge of thunderclouds.
       •Several million volts
       •Currents exceeding 20,000 amps.
   –Solar Noise: Ionized gases of the sun produces a
   wide range of frequencies that penetrate the
   Earth’s atmosphere.
   –Cosmic Noise Radiation of noise by distant stars
   penetrating the Earth’s atmosphere.Long haul
   telecommunications service (1500 km support
   20,000 to 60,000 voice channels)
•An alternative to fiber optic and coaxial cable
•Short point-to-point links between buildings
(closed-circuit TV or data link)