Discrete Signals Why ADC…

EKT430/4
DIGITAL SIGNAL
PROCESSING
2007/2008
CHAPTER 4
SAMPLING
OBJECTIVE:
After studying this lecture, you should learn to
explore:
 Relationship between Word length and
Quantization error,
 Meaning of specifications for various terms of ADC
and DAC,
 Sampling frequencies and its consequences.
 Concept of digital frequency.
2
DISCRETE SIGNALS:
Why ADC…
 Most real world signals are Analog.
but
 Digital processing of signals need them in digital
format.
This requires
Interfacing of analog input signal
and
Discrete to Digital conversion.
3
Sample and Hold
A time-signal, when passes through a  sec wide
time window, it is sampled.
 If the window appears periodically after every T
seconds, the signal is a train of discrete-time pulses
of  sec width & appears after every T sec.
 Its duty cycle is thus /T.
 The peak level of the sampled signal is retained
by a sample and hold (S/H) circuit.
 The hold time should be greater than the
conversion time of ADC.

4
Aperture time
The minimum time for which the sampling switch
should remain open is
Tap= 1/[2Bmax]
 For 16bit conversion of 20 kHz signal, the required
aperture time is:
Tap=1/[216x 2x20x203] seconds.
= 0.121 nsec.
5
Hold

The information is saved in a temporary register;
the register is a capacitor of a sample and hold
(S/H) circuit.

Such hold circuit is named a zero order hold
(ZOH).


One can choose a first order hold (FOH) also.
The ZOH selects peak level, while the FOH
uses trapezoid integration mode.
6
Discrete to Digital


The output of the hold circuit, has to take a
value among a predefined set of levels, termed as
a digitalization of the signal.
This process is called quantization.

The number of levels in the set are 2n where n is
the word length.

The common range of N lies between 8 to 14.
7
N-bit Uniform Quantization
Continuous input signal digitized into 2N levels.
1113
Quantisation step A =D/ L
where L = 2N
2
1
Ex:
D = 1V , N = 12
A = 244.1 V
0
-4
-3
-2
-1
0
1
2
3
4
V
-1
010
-2
Voltag%e ( = A)
001
-3
000
-4
LSB
VFSR
Scale factor (= 1/L=1 / 2N )
Percentage (= 100 / 2N )
1
A/ 2
0.5
0
-4
-3
-2
-1
0
1
2
3
4
Quantisation error
-0.5
-A/2
-1
8
Quantization of a Ramp
with eight quantization levels
Number of quantization levels:
Step=0.7
5V
i
0  40
xi
1
n
0.1 i
y
8
quantize ( x  n)
5.5
4.5
x
i
3.5
y
2.5
i
1.5
0.5
0
10
20
30
40
i
9
Quantization of Sinusoidal
with eight quantization levels
Number of quantization levels:
i
0  200
ai
sin
n
2  i
A
50
8
quantize ( a  n)
1
a
i
A
0
i
1
0
50
100
150
200
i
10
Quantization Error is caused
when a signal is discretized to
a finite word length.
Let D be the dynamic range;
L, the number of levels;
 Then the resolution or, step size is A=D/L.
 Since there is equal opportunity for any level to occur, we
take
 uniform probability distribution [,  ]
 represented by a pulse having
 height = 1/A and
 width lies in the step size range [-A/2,A/2].
 Note that the area under the probability curve is unity.
11
Quantization Error…
The variance 2 = noise power
P = 1/A
PN and

Thus Noise power ; PN = A2/12 = D2/12 L2
Or, 10 log (PN) = 20 log D – 20 log L – 10.8 dB
*For Tone frequency, it comes to 6.02dB+1.76 dB
A
A
2
2

pN
A
2
2
P d 

pN
1
A
2
 d
A
2
12
(S/N) dB
 Letting Ps be the signal power.
 If B=word length; L = 2B.
 (S/N) dB = 10 Log (Ps) -20 log D + 20 log (2B) + 10.8
dB
= 10 Log (Ps) + 6.02B + 10.8 - 20 log D dB.
 Thus
For a given dynamic range and input signal power,
(S/N)dB
increases
@ 6.02 dB per bit increase in word length.
13
Example:
A sampled signal that varies between - 2V to +2V is quantized
using B bits. What value of B will ensure an rms quantization
error of less than 5mV?
Solution:
 The noise power fed into 1 ohm resistance is given by the
square of the variance, 2=(D/L)2/12. Here D is the
dynamic range of the signal and L is the number of steps in
quantization given by 2B where B is the bit length.
 Problem specifies D = 4 V,  = 0.005 V.
 Use the formulae to calculate B:
 = (D/L)/√12 = (D/2B)/ √12;
 B is calculated to be 7.85  8.
14
A typical ADC
power
Configuration
control i/p
Configuration circuitry
Multichannel
analog i/p
Digital output
ADC
Circuit
Output
Interface
Output status
Control inputs
Control circuitry
15
ADC
Configuration Circuitry permits to configure
output in either Unipolar, Bipolar or 2’s complement
format, to suit applications.
 Control circuitry permits control of input channel,
leveling of the analog input, control of sample and
hold circuit, buffering the output, and to transfer
it in serial or, parallel format etc.
 Output controls flag of conversion, transfer of
data.

16
Mathematical model of DAC
 b’s represent presence or, absence of different binary numbers.
Xu = [b12-1+ b22-2+………+ bb2-b]; b’s are either 0 or 1.
Maximum value being [1 – 2-b],
for four bits, output ranges between: 0 – 0.9375
Xb = [b12-1+ b22-2+………+ bb2-b - 5];
Note: the first bit is sign bit, 1 being positive.
for four bits, output ranges between -0.5 : + 0.4375
Xc = [bc1 2-1 + b22-2 +……+ bb2-b – 0.5].
Note: in 2’s complement expression of Xc,, the code for
the first number is complemented and 1 is added.
It is equivalent to binary polar with off-set coding
and sign bit complemented]
17
Table of different coding
Table : Converter codes for B = 4 bits, and input 10 volts.
natural binary
offset binary
2's C
b1b2b3b4
m
XQ =Qm
m'
XQ =Qm'
b1b2b3b4
--
16
10.000
8
5.000
--
1111
15
9.375
7
4.375
0111
1110
14
8.750
6
3.750
0110
1101
13
8.125
5
3.125
0101
1100
12
7.500
4
2.500
0100
1011
11
6.875
3
1.875
0011
1010
10
6.250
2
1.250
0010
1001
9
5.625
1
0.625
0001
1000
8
5.000
0
0.000
0000
0111
7
4.375
-1
-0.625
1111
0110
6
3.750
-2
-1.250
1110
0101
5
3.125
-3
-1.875
1101
0100
4
2.500
-4
-2.500
1100
0011
3
1.875
-5
-3.125
1011
0010
2
1.250
-6
-3.750
1010
0001
1
0.625
-7
-4.375
1001
0000
0
0.000
-8
-5.000
1000
18
Different types of ADCs
 random Generally: Suitable for any signal
i) Flash: Instant: susceptible to errors
ii) Single slope Method: noise prone
iii) Dual slope Method: slow, accurate
iv) Successive Approximation: Fastest, best.
 For continuous signals with time-slope in known limits.
i) Delta Modulation ADC
ii) Adaptive Delta Modulation ADC
iii) Sigma Delta Modulation ADC etc.
19
DAC
A word-length of pulses are passed
through a weighted resistance network.
 The output waveform looks like a staircase.
 This waveform is passed through a low
pass filter for smoothening.
 The low pass filter (LPF) should have
linear phase characteristic.
 An ideal zero order hold (ZOH) is a
suitable LPF.

20
Zero-Hold Circuit:
a low pass filter
 The transfer function h(t) of a hold circuit is:
T
T  sin 2    f 
 Note linear phase-frequency
2
F( f )
T
characteristic.
2 f 
2
h( t )
1 if 0 t T
1
0.75
0 otherwise
sin
H(  )
T
T
2
T
2
0.5
j T
e
F( f )
0.25
0
2
0.25
0.5
4
3
2
1
0
f
1
2
3
4
21
Effect of Change of duty cycle of
a pulse on frequency response:
Note: product of height and first zero crossing of frequency is unity
T
1
4  3.9  4
f
F( f )
T
T  sin 2    f 
2
T
T
2 f 
2
F( f )
2
0.75
1.5
0.5
1
0.25
F( f )
0
0.25
0.5
3
2
1
0
f
1
2
3
F( f )
0.5
0
4
4  3.9  4
f
T
2 f 
2
1
0.5
2
T
T  sin 2    f 
2
4
1
4
3
2
1
0
1
2
3
4
f
22
Schematic of DAC
Configuration
Inputs
Digital
Inputs
Control
Inputs
Configuration Circuitry
Input
Interface
D/A Conversion
Circuitry
Analogue
Output
Control
Circuitry
Power Supply
23
Mathematical Models of DAC
An DAC can be:
The word length: b-bits, MSB to LSB.
 Unipolar Natural Binary
MSB
b1
B input bits
 Bipolar off-set binary
XQ
b2
DAC
b3
Analog output
bB
 Two’s complement.
LSB
R
(reference)
24
ALIASING
 Dictionary meaning: False presentation.
 For faithful recovery of the modulating signal,
carrier frequency  2.bandwidth of interest.
 It is called Nyquist Criteria-1.
 It is also applicable to sampling.
 Sampling is SC-AM.
 Here we multiply a train of pulses with signal.
The train of pulses here is carrier-wave.
25
What is Aliasing?
 According to the Fourier Transform, a time
domain impulse train having time period of Ts
seconds, results into a frequency train at frequency
difference of fs = 1/Ts.
 When a signal having a frequency fa is sampled by
an impulse train spaced at Ts= 1/fs, translates the
spectra in frequency domain around every integer
multiple of fs represented by
 [(nfs-fa) – (nfs+fa)].
26
What is Aliasing?
 If fs /2 < fa , the spread of spectra alias
that is interlace with each other.
 It prohibits signal’s reconstruction.
 To illustrate, we take a band of frequencies
between 0 to fa.
 In the Nyquist range, aliases can be at
(f  Nfs).
Take values of N Such that
these frequencies lie in the
range  fs/2.
27
Sampling Base-band signals
Continuous spectrum
(a)
(a) Base band signal:
(fMAX = B).
-B
0
(b)
B
f
Discrete spectrum
No aliasing
(b) Time sampling
frequency
repetition.
fS > 2 B
-B
0
B fS/2
f
Discrete spectrum
Aliasing & corruption
(c)
0
fS/2
no aliasing.
(c) fS
f
2B
aliasing !
Aliasing: signal ambiguity
in frequency domain
28
Antialiasing filter
(a)
(a),(b) Out-of-band spectra can
Signal of interest
Out of band
noise
Out of band
noise
aliase into band of interest. Filter it
before!
-B
0
B
(b)
f
(c) Antialiasing filter
Passband: depends on bandwidth of
interest.
-B
f
(c)
0
B fS/2
Attenuation AMIN : depends on
• ADC resolution ( number of bits N).
AMIN, dB ~ 6.02 N + 1.76
• Out-of-band noise magnitude.
Other parameters: ripple, stop-band
frequency...
29
Bandpass signal
centered on fC
Under-sampling ??
2  fC  B
2  fC  B
 fS 
m 1
m
For base-band,
both are same.
B
0
f
fC
m is selected so that fS > 2B
Nyquist theorem:
Maximum frequency of interest?
Maximum Bandwidth of interest?
-fS
f
0
fS
2fS
fC
Shift band pass signal to base-band signa
Example
fC = 20 MHz, B = 5MHz
a. Without under-sampling fS > 40 MHz.
b. With under-sampling?? fS = 22.5 MHz (m=1);
= 17.5 MHz (m=2); = 11.66 MHz (m=3).
c.
Advantages
 Slower ADCs / electronics
needed.
 Simpler antialiasing filters.
Or, in the spirit of Nyquist
30
Over-sampling: improves
quantisation signal to noise ratio
One bit equivalent quantisation SNR is
improved on each quadruple over-sampling.
This trade off is efficiently used in noise-shaping.
The unutilized signal power dispersed due to
quantization, is absorbed and thus utilized by the
frequency spectra created due to over-sampling.
for details refer
(a) Orfanidis, ‘Introductin to signal processing’ PHI, pp.67-71’
(b) Ambarder,’Analog & Digital signal processing’ 2/e, pp463-465.
31
Let us take a problem on aliasing..
 A 100 Hz sinusoidal is sampled at rates of (a) 240Hz,
(b) 140 Hz, (c) 90 Hz and (d) 35 Hz. Workout each case
for aliasing signals?
Solution
 The signal is: xa (t) = cos(2f t ) ; f=100 is the signal
frequency, fs is the sampling frequency and N is an
integer. New spectra of frequencies in the Nyquist range
decided by the sampling frequency is calculated using
the formulae (f  Nfs). Hence:
(a) f = 240 Hz > 200 Hz, calls for absence of aliasing.
(b) For f =140 Hz, aliased frequency component is:
fa=(100 –140) = -40 Hz.
The aliased Signal is:
xa(t) = cos(-80t ) = cos(80t -).
32
(c) When fs = 90 Hz,
fa = (100-90) Hz = 10 Hz.
The aliased Signal is: xa(t)=cos(20t ),
(d) When fs = 35 Hz,
fad= (100 – thrice 35) Hz = -5 Hz.
Thrice is taken so that the alias is in principal
frequency range.
The aliased signal is :
xa(t) = cos(-10t ) = cos(10t - ).
Note the phase change in (b) and (d) above.
33
Yet another example on
aliasing....
 Given x(t) = 4 + 3cos(t)+2cos (2t)+cos (3t),t is in msec.
Determine the recovered signal xa(t) if the signal is sampled
at half its Nyquist rate.
 Maximum signal frequency is 1.5 kHz. Hence the Nyquist
rate is 2x1.5 = 3 kHz. The signal x(t) is sampled at half the
Nyquist rate i.e. at 1.5 kHz. The range of output frequencies
lie within-0.75 kHz ≤ f ≤ 0.75kHz.
 Result: xa(t) = 5 + 5cos (t) and the waveforms:
34
Waveform :
x( t )
3 cos (  t )
4
2 cos ( 2  t )
cos ( 3  t )
10
x( t )
5
5 cos(  t )
5
0
0
5
10
t
35
Yet another problem…
 The above signal can be rewritten as:
x(t) = 3sin (t) + 2sin (5t) = x1(t) + x2(t).
X1(t), since lies in the Nyquist range
-0.5fs≤ f ≤ 0.5fs,, will not alias.
 However x2(t), since lie out side the Nyquist
range, alias.
 The resulting frequency will be [5t- 6t= -t].
 The output is xa (t)=3sin (t)+2sin (-t)= sin (t).
 Resulting waveforms in next slide
36
The waveform of DSP02_04_G
x( t )
s in (  t )
4 s in ( 3  t ) cos ( 2  t )
5
3
x( t )
sin(  t )
1
1
3
5
0
1
2
3
4
5
t
37
summary:
1. DSP involves time and amplitude quantization.
2. Time quantization: To avoid aliasing, the sampling
frequency fs should be  twice the maximum
signal Bandwidth of interest.
3. We can as well increase fs. Higher fs implies more
sampled data more processing time  more
storage space. Value of fs is decided by the
maximum signal bandwidth of interest. This
highest filterable frequency is decided from the
spectra of the signal.
4. It is a source of error.
38
summary:
5. Anti-aliasing (pre) filtering truncates the signal by
removing the rejectable frequency component of
the signal.
6. ADC is used for level quantization (digitalization).
Higher word-length, n, too will require more
processing time and more storage space.
7. “Time sampled and amplitude quantized” data is
processed in DSP.
8. Output of DSP may be converted back in analog
form using DAC followed by post-filtering. It uses
analog electronics.
39
Anti-aliasing Filter
 It is also called a pre-filter, a post-filter is
employed after DAC, if used.
 It is an analog filter.
 It can be a low-pass or, band pass one with linear
phase characteristics.
 Error is caused due to spectra truncation of the
signal.
 The brick-wall characteristic is ideal, but not
practically realizable.
 The low-pass filters can be complex.
40
Defining digital frequency
Digital frequency, FD, is a concept.
 It is normalization of frequencies.
 Use of it reduces calculations.
 It is a ratio of signal frequency to
sampling frequency: FD = f/fs.
 Units are cycles/sample.
 fs is samples per second.

41
Defining digital frequency
|FD| ≤ 0.5 is the newly defined Nyquist range, here
the signal is completely recoverable.
 An input signal can be sampled at some frequency
fs1 and reconstructed at other frequency say fs2.
The frequency of the recovered signal will be
multiplied by the factor: (fs2/fs1) provided that
Nyquist range is maintained...
42
Example
illustrate frequency scaling due to different sampling
rate at recovery....
A 100 Hz sinusoidal (fx) is sampled at S Hz. The
sampled signal is then reconstructed at 540 Hz.
What is the frequency of the reconstructed signal fr,
if (i) S = 270 Hz (ii) 70 Hz.
(a) For S1 = 270 Hz, the digital frequency of the
sampled signal is FD = 100/270. It lies in the
principal period.
The frequency of reconstruction fr is:
fr = (S2/S1) x fx = (540/270)x100 = 200Hz.
43
(b) If S = 70 Hz, the FD = 100/70.
It lies outside the principal range. It is a case of
alias. The alias freq. :
fa = (100-70) = 30 Hz
and
(100-2X70)= -40 Hz.
The second case is outside the principal period
of  35 Hz, hence not considered. The
reconstructed aliased frequency is 30x 540/70.
44
Simplification of anti-alias filters
 To avoid the aliasing while the sample frequency is
low, requires a high order low pass filter.
 Examples are Butterworth and Tchebyshev filters
type 1,2 and 3. Some of these Tchebyshev filters
have pass band ripple and can be a source of error.
 Such filters use low drift operational amplifiers and
precise R, C elements.
 These filters are bulky, costly and difficult to tune.
 Linear phase together with high magnitude
attenuation characteristic is impossible to implement.
 Hence we use alternative technique….
45
Continued…alternatively…
Use of a simple Low Pass analog filter,
sample @ many times, say X4, the Nyquist rate.
A high attenuation linear phase digital filter is used.
Decimation process is now applied.
Here three samples are skipped and one sample
out of every 4 is taken.

Compensation, if needed, is also digitally provided.

At the output, fill in the three skips using
interpolation and use a DAC followed by a simple low
pass analog filter.

Isn’t technically excellent and robust scheme ?





46