You are on page 1of 34

9/15/2020

BIEÁN ÑOÅI A/D, D/A

ANALOG DIGITAL DIGITAL ANALOG


INPUT INPUT OUTPUT OUTPUT

ÑAÏI
HEÄ THOÁNG
LÖÔÏNG
VAÄT LYÙ CAÛM BIEÁN ADC XÖÛ LYÙ SOÁ DAC
(MAÙY TÍNH)

ÑIEÀU
KHIEÅN,
ÑLVL
KHAÙC

1. Quá trình lượng tử hóa

Quá trình xử lý tín hiệu tương tự

Bộ khôi phục
Bộ lấy mẫu
Analog tín hiệu Analog
và lượng tử DSP
Input tương tự Output
(A/D)
(D/A)

1
9/15/2020

1. Quá trình lượng tử hóa

Bộ lấy mẫu và lượng tử Tín hiệu đã


Lấy mẫu & giữ lượng tử
x(t) x(nT) xQ(nT)
Bộ chuyển đổi
Tín hiệu A/D Đến
tương tự Tín hiệu (Lượng tử) DSP
đã lấy
mẫu B bits/mẫu

Các thông số đặc trưng:


• Số bit biểu diễn B
• Tầm toàn thang R

1. Quá trình lượng tử hóa

2
9/15/2020

1. Quá trình lượng tử hóa


Xét ví dụ lượng tử đều (B = 4, R = 8)
4
4

3
3

2
2

1
1

0
0

-1
-1

-2

-3

-4
0
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7

Accuracy
xq(t)

t
Ts

Higher Sampling rate Higher Resolution


xq(t) xq(t)

t t
Ts

3
9/15/2020

Number of Bits (N) Resolution (1/2N) Increment (mV) for 5 volts

6 1/64 78.1
8 1/256 19.6
10 1/1024 4.9
12 1/4096 1.2
14 1/16384 0.3
16 1/65536 0.07

1. Quá trình lượng tử hóa

• Độ rộng lượng tử (độ phân giải lượng tử)


R
Q
Phân loại 2B
• Bộ ADC đơn cực: 0 ≤ xQ(nT) < R
Bộ ADC lưỡng cực: -R/2 ≤ xQ(nT) ≤ R/2

• Lượng tử theo pp làm tròn


Lượng tử theo pp rút ngắn (truncated)

4
9/15/2020

1. Quá trình lượng tử hóa

• Sai số lượng tử e(nT )  xQ (nT )  x(nT )

• Lượng tử theo pp làm tròn


Q Q
 e
2 2

=> Sai số lượng tử cực đại là emax = Q/2

1. Quá trình lượng tử hóa


• Giả sử sai số lượng tử e là biến ngẫu nhiên có phân bố đều
trong khoảng [-Q/2;Q/2]
p(e)
• Hàm mật độ xác suất :
1 Q Q 1/Q
p(e)  ;  e
Q 2 2

-Q/2 0 Q/2 e
Q/2

e  E (e)   e. p (e)de  0
Q / 2

5
9/15/2020

1. Quá trình lượng tử hóa


• Giá trị trung bình của e:
Q/2

e  E (e)   e. p (e)de  0
Q / 2
• Giá trị trung bình bình phương của e:
Q/2
Q2
e  E (e )   e 2 p (e) de 
2 2

Q / 2
12
• Sai số lượng tử hiệu dụng:

Q
erms  e 2 
12

1. Quá trình lượng tử hóa


R
• Tỷ lệ tín hiệu trên nhiễu: SNR 
Q
• Tính theo dB:
R
SNR  20 log10    6 B (dB)
Q
 Quy luật 6dB/bit

• Ví dụ: Tín hiệu được lấy mẫu với tốc độ 44kHz và mẫu được
lượng tử hóa bằng bộ chuyển đổi A/D tầm toàn thang 10V.
Xác định số bit B để sai số lượng tử hiệu dụng phải nhỏ hơn
50 μV. Tính sai số hiệu dụng thực sự & tốc độ bit theo bps

6
9/15/2020

Q
e rms   R 2  B / 12
12

 R   10 
 B  log 2    log 2   15 ,82
 e rms 12   50 .10
6
12 

Làm tròn B = 16bit

e rms  R 2  B / 12  44  V

Tốc độ bit là: Bfs = 16 × 44 = 704 kbps

2. Bộ chuyển đổi D/A

• Xét bộ DAC B bit, tầm toàn thang R, ngõ vào B bit

MSB
b1
b2
B
b3 xQ
bits DAC
đầu Analog
vào output
bB
LSB
R
(reference)

7
9/15/2020

2. Bộ chuyển đổi D/A

(a) Nhị phân đơn cực thông thường (Unipolar natural binary)
xQ  R (b1 2 1  b2 2 2  ...  bB 2  B )
(b) Nhị phân offset lưỡng cực (bipolar offset binary)

xQ  R (b1 2 1  b2 2 2  ...  bB 2  B  0.5)

(c) Lưỡng cực lấy bù 2 (bipolar 2’s complement)

xQ  R (b1 2 1  b2 2 2  ...  bB 2  B  0.5)

BIEÁN ÑOÅI D/A

D
DIGITAL C D/A
CONVERTER ANALOG
INPUTS B
(DAC) OUTPUT
A
DAC 4 BIT

D C B A Vout Toång quaùt:


0 0 0 0 0V
Analog output = K  digital intput

1 1 1 1 15V K: thöøa soá (ñoä phaân giaûi)

8
9/15/2020

Digital-to-Analog Conversion

• Data in clean binary digital form can be


converted to an analog form by using a
summing amplifier.
• For example, a simple 4-bit D/A converter
can be made with a four-input summing
amplifier.

Digital-to-Analog Conversion

• 2 Basic Approaches

– Weighted Summing Amplifier


– R-2R Network Approach

9
9/15/2020

Weighted Sum DAC


• One way to achieve D/A conversion is to
use a summing amplifier.
• This approach is not satisfactory for a large
number of bits because it requires too much
precision in the summing resistors.
• This problem is overcome in the R-2R
network DAC.

Weighted Sum DAC

10
9/15/2020

R-2R Ladder DAC

R-2R Ladder DAC

11
9/15/2020

R-2R Ladder DAC


• The summing amplifier with the R-2R ladder of
resistances shown produces the output where the D's
take the value 0 or 1.
• The digital inputs could be TTL voltages which
close the switches on a logical 1 and leave it
grounded for a logical 0.
• This is illustrated for 4 bits, but can be extended to
any number with just the resistance values R and
2R.

TD: K = 1V  Vout = (1V)  digital input


Do ñoù, ta coù theå tính Vout öùng vôùi digital input
11002 = 1210  Vout = 1V  12 = 12V.

TD: DAC 5 bit vôùi ngoõ vaøo laø 10100, doøng ngoõ ra laø 10mA.
Tính Iout khi ngoõ vaøo laø 11101.
Giaûi
Ta coù: 101002 = 2010 khi Iout = 10mA.
 K = 0,5 mA.
Do ñoù: 111012 = 2910
 Iout = 0,5mA  29 = 14,5mA.

12
9/15/2020

TD: DAC 8 bit vôùi ngoõ ra laø 1.0V khi ngoõ vaøo laø 001100102.
Xaùc ñònh Vout lôùn nhaát cuûa DAC.
Giaûi
Ta coù: 001100102 = 5010
1V = K  50
 K = 20 mV.
Do ñoù, ngoõ ra Vout(max) khi ngoõ vaøo laø: 1111 11112 = 25510
 Vout(max) = 20mV  255 = 5,1V.

Ñoä phaân giaûi K: ñoä phaân giaûi cuûa bieán ñoåi D/A laø söï thay ñoåi
nhoû nhaát cuûa ngoõ ra analog khi coù söï thay ñoåi cuûa ngoõ vaøo
digital.

Clock Ñeám Vout 3V


DAC
4 bit 2V
1V
0V

Ñoä phaân
giaûi 1V

DAC N bit seõ coù 2N möùc khaùc nhau, soá böôùc nhaûy seõ laø 2N – 1
TD: K = 0,2V. Xaùc ñònh Vout khi ngoõ vaøo laø 10001
100012 = 1710
 Vout = 0,2V  17 = 3,4V.

13
9/15/2020

3. Bộ chuyển đổi A/D

MSB b1
b2 B
x b3 bits
ADC
Analog đầu
input ra
bB
LSB
R
(reference)

BIEÁN ÑOÅI A/D

ñaàu vaøo analog 1

0 Start
vA +
Ñôn vò
OPAMP
-
ñieàu khieån Clock
So saùnh

EOC
(keát thuùc chuyeån ñoåi)
Boä bieán Thanh
ñoåi DA ... ghi
vAX

Keát quaû digital

14
9/15/2020

Boä bieán ñoåi hoaït ñoäng theo caùc böôùc:


o Tín hieäu Start ñeå baét ñaàu bieán ñoåi.
o Cöù moãi xung clock, ñôn vò ñieàu khieån söûa ñoåi soá nhò phaân ñaàu ra
vaø ñöa vaøo löu tröõ trong thanh ghi.
o Soá nhò phaân trong thanh ghi ñöôïc chuyeån ñoåi thaønh aùp analog VAX
qua boä bieán ñoåi DA.
o OPAMP so saùnh VAX vôùi aùp ñaàu vaøo vA. Neáu VAX < VA thì ñaàu ra
ôû möùc cao, coøn ngöôïc laïi, neáu VAX vöôït qua VA moät löôïng vT (aùp
ngöôõng) thì ñaàu ra ôû möùc thaáp vaø keát thuùc quaù trình bieán ñoåi. Ở
thôøi ñieåm naøy, VAX ñaõ xaáp xæ baèng VA vaø soá nhò phaân chöùa trong
thanh ghi chính laø giaù trò digital xaáp xæ cuûa VA (theo moät ñoä phaân
giaûi vaø chính xaùc nhaát ñònh cuûa töøng heä thoáng).
o Ñôn vò ñieàu khieån kích hoaït tín hieäu EOC, baùo raèng ñaõ keát thuùc
quaù trình bieán ñoåi.

Types of Analog to Digital Converters

• Flash ADC
• Sigma-delta ADC
• Dual slope converter
• Successive approximation converter

15
9/15/2020

Flash ADC • “parallel A/D”


• Uses a series of
comparators
• Each comparator
compares Vin to a
different reference
voltage

Converter Comparator Outputs Encoder Output


input
range (V) A B C D E F G
<1 0 0 0 0 0 0 0 000
>1-2 1 0 0 0 0 0 0 001
>2-3 1 1 0 0 0 0 0 010
>3-4 1 1 1 0 0 0 0 011
>4-5 1 1 1 1 0 0 0 100
>5-6 1 1 1 1 1 0 0 101
>6-7 1 1 1 1 1 1 0 110
>7 1 1 1 1 1 1 1 111

Flash ADC

Comparator is one use


of an Op-Amp
VIN
+ VOUT
VREF - If Output
VIN > VREF High
VIN < VREF Low

16
9/15/2020

Boä bieán ñoåi Flash AD

Boä bieán ñoåi loaïi naøy coù toác ñoä nhanh nhaát vaø cuõng caàn nhieàu
linh kieän caáu thaønh nhaát.
Coù theå laøm moät pheùp so saùnh: flash AD 6-bit caàn 63 OPAMP,
8-bit caàn 255 OPAMP, vaø 10-bit caàn 1023 OPAMP. Vì leõ ñoù maø boä
bieán ñoåi AD loaïi naøy bò giôùi haïn bôûi soá bit, thöôøng laø 2 ñeán 8-bit.

Ví duï moät flash AD 3-bit :


Maïch naøy coù ñoä phaân giaûi laø 1V, caàu chia ñieän aùp thieát
laäp neân caùc ñieän aùp so saùnh (7 möùc töông öùng 1V, 2V, …) vôùi
ñieän aùp caàn bieán ñoåi. Ñaàu ra cuûa caùc OPAMP ñöôïc noái ñeán moät
priority encoder vaø ñaàu ra cuûa noù chính laø giaù trò digital xaáp xæ
cuûa ñieän aùp ñaàu vaøo.
Caùc boä bieán ñoåi coù nhieàu bit hôn deã daøng suy ra theo
maïch naøy.

Parallel or Flash ADC


• Very High speed conversion
– Up to 100MHz for 8 bit
resolution
– Video, Radar, Digital
Oscilloscope
• Single Step Conversion
– 2n –1 comparator
– Precision Resistive
Network
– Encoder
• Resolution is limited
– Large number of
comparator in IC

34

17
9/15/2020

Flash ADC

Advantages Disadvantages
• Very fast • Needs many parts
(255 comparators
for 8-bit ADC)
• Lower resolution
• Expensive
• Large power
consumption

Sigma-Delta ADC

Integrator
Digital
Vin + Σ  + Sample
- low-pass decimator
- filter
Oversampler
Serial output
1-bit
DAC

• Oversampled input signal goes in the integrator


• Output of integration is compared to GND
• Iterates to produce a serial bitstream
• Output is serial bit stream with # of 1’s proportional
to Vin

18
9/15/2020

Sigma-Delta ADC

Advantages Disadvantages

• High resolution • Slow due to


• No precision oversampling
external
components
needed

Integrating or Dual Slope A/D

integrator
comparator
Vin

-Vref
clock Control logic

Counter

Digital Output

19
9/15/2020

When conversion is initialized, the switch is connected to Vin which


is applied to the op amp integrator. The integrator output (>0) is
applied to the comparator

integrator
Vin comparator

-Vref
clock Control logic

Counter

Digital Output

As conversion is initiated, the control logic enables the clock which


then sends pulses to the counter until the counter fills (9999)

integrator
Vin comparator

-Vref
clock Control logic

Counter

Digital Output

20
9/15/2020

As the counter resets (9999  0000), an overflow signal is sent to the control
logic
this activates the input switch from Vin to -Vref ,
applying a negative reference voltage to the
integrator
integrator
comparator
Vin

-Vref
clock Control logic

overflow
Counter

Digital Output

The negative reference voltage removes the charge stored in the


integrator until the charge becomes zero.

At this point, the comparator switches states producing a signal


that disables the clock and freezes the counter reading.

The total number of counts on the counter (determined by the


time it took the fixed voltage Vref to cancel Vin ) is proportional to
the input voltage, and thus is a measure of the unknown input
voltage.

21
9/15/2020

The operation of this A/D requires 2 voltage slopes, hence


the common name DUAL-SLOPE.

full scale conversion


charging up the
discharging the
Integrator Output Voltage

capacitor
capacitor

half scale conversion

quarter scale conversion

fixed time
measured time

Since this A/D integrates the input as part of the measuring


process, any random noise present in the signal will tend to
integrate to zero, resulting in a reduction in noise.

These type of A/D s are used in almost all digital meters. Such
meters usually are not used to read rapidly changing values in the
lab. Consequently the major disadvantage of such converters
(very low speeds) is not a problem when the readout update rate is
only a few times per second.

22
9/15/2020

Dual Slope converter


Vin
tFIX tmeas
t

• The sampled signal charges a capacitor for a fixed amount of


time
• By integrating over time, noise integrates out of the conversion.
• Then the ADC discharges the capacitor at a fixed rate while a
counter counts the ADC's output bits. A longer discharge time
results in a higher count.

Dual Slope Integrating ADC


• Operation T1
• Excellent Noise Rejection
– Integrate 0 vi dt – High frequency noise cancelled
t2
out by integration
– Reset and integrate 0 Vr dt
– Thus T1vi ( AVG )  t2Vr – Proper T1 eliminates line noise
–  vi ( AVG )  Vr t2 – Easy to obtain good resolution
• Applications T1 • Low Speed
– DPM(Digital Panel Meter), – If T1 = 60Hz, converter
DMM(Digital Multimeter), … throughput rate < 30 samples/s

46

23
9/15/2020

Dual Slope converter

Advantages Disadvantages

• Input signal is • Slow


averaged • High precision
• Greater noise external components
immunity than other required to achieve
ADC types accuracy
• High accuracy

Successive Approximation
Is Vin > ½ ADC range? • Sets MSB
• Converts MSB to
- analog using DAC
+ SAR DAC
VIN • Compares guess to
1000 0000
0100 input
Out • Set bit
If no, then test next bit • Test next bit

24
9/15/2020

Boä bieán ñoåi A/D xaáp xæ lieân tieáp


ñaàu vaøo
START
analog
vA +
Clock Xoùa taát caû caùc bit
OPAMP
- Baét ñaàu ôû MSB
Ñôn vò Start
So saùnh
ñieàu khieån
EOC Set bit = 1
...
Ñuùng
VAX > VA Clear bit = 0
Thanh ghi
MSB ……… LSB ?
Sai
Ñeán bit Sai
... Xong heát bit ?
thaáp keá
Ñuùng
Boäâ bieán ñoåi DA Quaù trình bieán ñoåi keát
thuùc vaø giaù trò bieán ñoåi
naèm trong thanh ghi
vAX

END

ñaàu vaøo analog Clock

vA + EOC
OPAMP
Start
-
So saùnh
vA
vAX Khi chuyeån
Reset ñoåi hoaøn taát,
counter
ngöøng ñeám
Boäâ bieán Counter Clock EOC
ñoåi DA ...
tC
vAX
Start

Keát quaû digital

25
9/15/2020

Successive Approximation ADC


• Circuit waveform

• Conversion Time
– n clock for n-bit ADC
– Fixed conversion time
• Serial Output is easily
generated
– Bit decision are made in
serial order
• Logic Flow

51

•Boä bieán ñoåi AD xaáp xæ lieân tieáp


Ñaây laø boä bieán ñöôïc duøng roäng raõi nhaát trong caùc boä bieán
ñoåi AD. Noù coù caáu taïo phöùc taïp hôn boä bieán ñoåi AD theo haøm doác
nhöng toác ñoä bieán ñoåi nhanh hôn raát nhieàu. Hôn nöõa, thôøi gian
bieán ñoåi laø moät soá coá ñònh khoâng phuï thuoäc giaù trò ñieän aùp ñaàu
vaøo.
Sô ñoà maïch töông töï nhö boä bieán ñoåi AD theo haøm doác
nhöng khoâng duøng counter cung caáp giaù trò cho boä bieán ñoåi DA
maø duøng moät thanh ghi. Ñôn vò ñieàu khieån söûa ñoåi töøng bit cuûa
thanh ghi naøy cho ñeán khi coù giaù trò analog xaáp xæ aùp vaøo theo moät
ñoä phaân giaûi

26
9/15/2020

Successive Approximation ADC


• Block Diagram
• Most Commonly used in
medium to high speed
Converters
• Based on approximating the
input signal with binary code
and then successively revising
this approximation until best
approximation is achieved
• SAR(Successive
Approximation Register) holds
the current binary value

53

Successive Approximation ADC


• Circuit waveform

• Conversion Time
– n clock for n-bit ADC
– Fixed conversion time
• Serial Output is easily
generated
– Bit decision are made in
serial order
• Logic Flow

54

27
9/15/2020

Successive Approximation

Advantages Disadvantages

• Capable of high • Higher resolution


speed successive
• Medium accuracy approximation ADCs
compared to other will be slower
ADC types • Speed limited
• Good tradeoff ~5Msps
between speed and
cost

ADC Types Comparison

ADC Resolution Comparison


Dual Slope
Flash
Successive Approx
Sigma-Delta

0 5 10 15 20 25
Resolution (Bits)

Type Speed (relative) Cost (relative)


Dual Slope Slow Med
Flash Very Fast High
Successive Appox Medium – Fast Low
Sigma-Delta Slow Low

28
9/15/2020

3. Bộ chuyển đổi A/D


Bộ ADC sử dụng pp xấp xỉ liên tiếp:
x SAR
+
_ b1 b2 b3 . . . bB
comparator MSB

xQ b1 b2 b3 . . . bB LSB
DAC

3. Bộ chuyển đổi A/D

 Thuật toán áp dụng cho mã hóa nhị phân thông thường và


offset (với bộ DAC tương ứng) và lượng tử theo kiểu rút
ngắn.

 Để lượng tử hóa theo pp làm tròn: x được dịch lên Q/2


trước khi đưa vào bộ chuyển đổi.

 Đối với mã bù 2: bit MSB là bit dấu nên được xét riêng.
Nếu x ≥ 0 thì MSB = 0.

29
9/15/2020

3. Bộ chuyển đổi A/D


• Ví dụ: Lượng tử hóa x = 3.5 theo biểu diễn nhị phân offset, pp
rút ngắn, B = 4 bit và R = 10V.

Test b1b2b3b4 xQ C = u(x – xQ)

b1
1000 0,000 1
b2
1100 2,500 1
b3
1110 3,750 0
b4
1101 3,125 1
1101 3,125
=> b = [1101]

3. Bộ chuyển đổi A/D


• Ví dụ: Lượng tử hóa x = 3.5 theo biểu diễn nhị phân thông
thường, pp rút ngắn, B = 4 bit và R = 10V.

Test b1b2b3b4 xQ C = u(x – xQ)

b1
1000 5,000 0
b2
0100 2,500 1
b3
0110 3,750 0
b4
0101 3,125 1
0101 3,125
=> b = [0101]

30
9/15/2020

7
Vref
8
Vin
4
Vref
8

Vref
8

3. Bộ chuyển đổi A/D


• Ví dụ: Lượng tử hóa x = 3.5 theo biểu diễn nhị phân thông
thường, pp làm tròn, B = 4 bit và R = 10V.
y = x + Q/2 = 3.5 + 0.3125 = 3.8125
Test b1b2b3b4 xQ C = u(x – xQ)

b1
1000 5,000 0
b2
0100 2,500 1
b3
0110 3,750 1
b4
0111 4,375 0
0110 3,750
=> b = [0110]

31
9/15/2020

Ví dụ 1
• Bộ ADC 3 bits xấp xỉ liên tiếp, dạng lưỡng cực bù 2, tầm toàn
thang R = 16V. Xác định giá trị lượng tử và biểu diễn 3 bits
của x = 2.9; 3.1; 3.7; 4; -2.9; -3.1; -3.7; -4.

Giải với x = -2.9


+ R = 16 V; B = 3 bits/sample  Q = R/2B = 2V
+ Để lượng tử theo kiểu làm tròn về mức lượng tử gần nhất: y
= x + Q/2 = -2.9 + 1 = -1.9
+ Biểu diễn dạng bù 2, x < 0  b1 = 1


xQ  R b1 2 1  b2 2 2  b3 2 3  0.5 

Ví dụ 1
Xấp xỉ liên tiếp:
Test b1b2b3 xQ C
b2 110 -4 1
b3 111 -2 1
111 -2

Kết quả: giá trị lượng tử xQ = -2, biểu diễn bởi mã 111

Các câu còn lại giải tương tự.

32
9/15/2020

Ví dụ 2
• Chọn bộ ADC thỏa yêu cầu:
– Tầm toàn thang R = 10V
– Sai số lượng tử hiệu dụng erms < 1mV
Số bits/sample ? Sai số hiệu dụng thực sự ? Tầm động theo dB?
Giải
Q
erms   eexpected  Q  eexpected 12
12
R  R 
Q  B  B  log 2    B  11.49
2  eexpected 12 

Chọn B = 12 bits/sample

Ví dụ 2
• Sai số hiệu dụng thực sự với B = 12 bits
Q R / 2B
erms    0.7 mV
12 12

• Tầm động (dB)


SNR(dB) = 10log10(R/Q) = 10.B.log102 =72 dB

33
9/15/2020

Ví dụ 3
Để ghi 1 phút stereo với chất lượng CD cần 10MB đĩa cứng. Giải
thích?
Giải
Chất lượng CD: fs = 44 kHz = 44000 mẫu/s, 16 bits/mẫu
Stereo = 2 channels
 Dung lượng cần:
44000 mẫu/s* 16 bits/mẫu * 60 s/phút * 2 channels
Tính ra được dung lượng (theo bits)  đổi ra MB
Lưu ý: 1MB = 210KB = 220 Bytes
1 Byte = 8 bits

Ví dụ 4
• Hệ thống hòa âm số có 16 kênh, fs = 48kHz, 20 bits/mẫu. Tính
dung lượng đĩa cứng để lưu 1 ca khúc dài 3 phút, ghi âm 16
kênh.
Giải
Tương tự như ví dụ 3
Dung lượng:
48000 mẫu/s * 20 bits/mẫu * 60 s/phút * 3 phút * 16 kênh

34

You might also like