Encoding

Encoding
How is information represented?
Way of looking at techniques
Data
Digital
Analog
Medium
Digital
Analog
NRZ
Manchester
Differential Manchester
ASK
FSK
PSK
modems
Phase Coded Modulation
(digitized voice)
AM/FM radio
Television
Analog vs Digital
Figure 3.1
Edges are crisper on digital.
Attempt to store discrete vs continuous waveforms.
Some information is more naturally analog.
Some is digital.
Analog
• Light waves
• Sound waves
– natural
– am fm radio
• Most waves in nature
• Waves are categorized according to
frequency
Digital
• Most digital information derives from
computer representation.
• Examples
– programs
– data
• Memories force representation to be digital
because they store information digitally
– in one of two states
DIGITAL and ANALOG are not really that different!
Digital Data on
Digital Signal
NRZ -> 1 is low, 0 is high
T, duration of 1 bit
high
value
Time
low
value
Figure 3.2 NRZ Encoding
1
0
1
0
0
1
1
0
Beginning and End of a bit
If the values are not changing, how can the bit times
be determined?
constant voltage level
high
value
Time
low
value
Figure 3.3 NRZ Encoding of a Sequence of 0s
Adding Timing to the Info
Manchester -> Downward middle 0,
Upward middle 1
T, duration of 1 bit
high
value
Time
low
value
0
1
0
1
1
0
0
1
Figure 3.4 Manchester Encoding
What general observation can you make about the bandwidth cost?
Another Digital encoding
Differential Manchester -> No change at beginning 1
Change at beginning 0
T, duration of 1 bit
Signal level at start of
transmission
high
value
Time
low
value
1
0
1
Figure 3.5 Differential Manchester Encoding
0
0
1
1
0
Remember
More timing is essential
Costs bandwidth
Leaves less room for data
Analog Data on Digital Signal
•
•
•
•
Phone system was analog (lines and switches)
Computers led to digital lines and switches
Most lines still analog to end-office
Most phones analog
lines
Phone
lines
End Office
End Office
Phone
How to convert?
Fig 3.12
Pulse Code Modulation
• Take samples
• Encode as digital values
• At receiver, use digital samples to convert
back to analog.
• Sources of ERROR
– Number of samples
– Precision of samples
Process of PCM
3.17
3.18
Reverse upon reception!
Too few samples
Fig 3.19
Signal changes too fast.
Intuition tells you to sample more often.
How fast?
Familiar Examples
Two points make a line.
Less.. Not enough
More .. Redundant
Three points make a
parabola..
Less.. Not enough
More .. Redundant
How about a sine wave?
•
•
•
•
•
Twice as fast as the frequency of the wave
Actually the highest frequency component
20-20000Hz -> sample at 40000 Hz
Called the Nyquist rate
Sampling too fast is a waste!
s2f
Accuracy
•
•
•
•
Number of levels dictates number of bits
8 levels -> 3 bits
256 levels -> 8 bits
Too few levels -> lose accuracy
reconstructing.
• Consider a simple case of TWO levels.
• Can’t have too many, but can only afford a
limited amount!
CD sound application
44.1 Khz
16 bit linear
About 44000 samples / sec
or 22000 Hz signal
Range of hearing about 20Khz
16 bits generates 2^16 levels
or 64000 levels
Each sample is accurate to
one part in 64000.
A function of personal taste.
44000 samples x 2 Bytes = 88K Bytes per sec
60 secs requires 60 x 88K = 5280 K Bytes or 5.3 M Bytes
Analog Data on Analog Signal
•
•
•
•
Before the digital/computer age
Dying
Still used in tv, radio, cable tv, etc
Carrier signal “carries” the information
Carrier frequency
900
1260
1340
S(f)
Band 1
850-950
Band 2
1110-1210
Band 3
1290-1390
Radio Signal
1000Hz
f
Figure 3.15
•
•
•
•
Information -> SLOWEST frequency
Carrier -> HIGHEST frequency
Review previous example
Think about your radio station
– YOU ONLY HEAR UP TO 20000 Hz
– Channel is much higher frequency for AM and
higher yet for FM
• Not perfect example. But correct idea.
Digital Data on Analog Signal
• Modems
• Telephone line to the house is analog but
information in the computer is digital.
• Lots of progressively complicated
techniques in this section.
Back to Amplitude Frequency
and Phase
• Encoding is change
• Encode 0 or 1 with a change in one or more
of the basic wave features
• Some techniques can “squeeze” more
information into the signal by using
combinations.
Frequency Shift Key
Fig 3.13
0
1
0
0
Frequency (FSK)
1
Amplitude Shift Key
Typically have many
cycles per bit time.
1
0
1
0
SameFrequency. Different Amplitudes.
Phase Shift Key
0
1
0
Phase change
0
How many bits per change?
•
•
•
•
•
Two amplitudes -> 0 or 1 -> 1 bit
Four amplitudes -> 00, 01, 10, 11 -> 2 bits
Eight amplitudes -> 000, … 111 -> 3 bits
How far can you go?
Forever as long as you have no noise and
the sender can control with that resolution
and the receiver can distinguish those small
differences. Of course there is always noise!
Baud vs Bit Rate example
3.14
Four levels -> 2 bits per change
If this is ONE second, bit rate is 8 bps
Baud rate is 4 per second (changes per second)
ASK and PSK in Combination
3.15
2 amplitudes, 4 phases -> 8 combinations
8 combinations -> 3 bits per change.
What is the ultimate limit?
• Noise
• Shannon’s theorem tells theoretically how
far you can go based on noise.
• In practice even that is not achieved.
• Compression is another technique that adds
the illusion of stretching this technique but
it is actually an orthogonal (independent)
issue.
How is noise measured?
Relative to the signal
S
N
ratio
Signal to noise. E.g. 1000 to 1
EQUIVALENTLY and more commonly
S
dB  log 10
in decibels
N
dB  10 log 10 1000  10 * 3  30
Shannon’s result
S
MaxBitRate  b  log 2 (1  )
N
Where b is the bandwidth
Example -> 20Khz medium with 30db signal to noise
MaxBitRate = 20000 * log2(1+1000)
=(about) 20000 * 9.7
= 194,000 bps
Bandwidth vs Noise
• As bandwidth goes up, “bit” width becomes
smaller
• As bit width becomes smaller, edges
become more critical for proper signal
interpretation
• Noise makes edges fuzzy and makes it more
difficult to distinguish levels