Escolar Documentos
Profissional Documentos
Cultura Documentos
(ADC)
EL3096 Sistem Mikroprosesor & Lab
Analog to Digital Converter
An analog-to-digital converter (abbreviated ADC, A/D or A
to D) is a device that uses sampling to convert a
continuous quantity to a discrete time representation in
digital form.
Resolution
The resolution of the converter indicates the number of
discrete values it can produce over the range of analog
values.
The resolution Q of the ADC is
EFSR
Q M M is the ADC's resolution in bits
E is the full scale voltage range
2 FSR
VIN
VINT tINT V0
RC
VIN
VINT V0 tINT
RC
VREF V0 RC
tINT
VIN
tINT VIN
Dual Slope Integrating ADC
VIN VREF V
VINT tINT V0 , V0 0 td IN tINT 0
RC RC RC
VIN VREF td
VUP tINT VDOWN td VUP 0 VIN VREF
RC RC tINT
Dual Ramp ADC
Successive Approximation ADC
State Diagram dari SAR-ADC
Sample & Hold
ADC jenis integrating & SAR perlu input yang tidak
berubah selama konversi, untuk itu perlu rangkaian
tambahan Sample & Hold
ADC pada ATMega8535: SAR
DAC
Summing Amplifier
DAC
2R V0
VTH V0
2R 2R 2
2R 2R
RTH R
2R 2R
A-to-D conversion: Typical embedded application
The ADC in ATmega8535
The ADC in ATmega16 has a 10-bit resolution.
The digital output has n = 10 bits.
The ADC has 8 input channels.
Analogue input can come from 8 different sources.
However, it performs conversion on only one channel at a time.
If default reference voltage Vref = 5V is used.
step size: 5(V)/1024 (steps) = ± 4.88mV.
accuracy: 2 × LSB = ± 9.76mV.
The clock rate of the ADC can be different from the CPU clock
rate.
One ADC conversion takes 13 ADC cycles.
An ADC prescaler will decide the ADC clock rate.
ADC unit ─ Relevant pins
ADC unit ─ Block diagram
Major aspect of ADC
What are the relevant ADC registers?
ADCMUX
ADCH/ADCL
ADCCSRA
SFIOR
What are the steps to use the ADC?
How to use the ADC interrupt?
ADC Multiplexer Selection Register (ADCMUX)
The clock of the ADC is obtained by dividing the CPU clock and a
division factor.
There are 8 possible division factors, decided by the three bits
{ADPS2, ADPS1, ADPS0}
Example: Using internal clock of 1MHz and a ADC prescaler bits of
‘010’, the clock rate of ADC is: 1MHz/4 = 250Hz.
Special Function IO Register (SFIOR)
Three flags in register SFIOR specify the event that will auto-
trigger an A-to-D conversion
Steps to use the ADC
Step 1: Configure the ADC using registers ADMUX, ADCSRA,
SFIOR.
What is the ADC source?
What reference voltage to use?
Align left or right the result in {ADCH, ADCL}?
Enable or disable ADC auto-trigger?
Enable or disable ADC interrupt?
What is the ADC pre-scaler?
Step 2: Start ADC operation
Write 1 to flag ADSC (register ADCCSRA).
Step 3: Extract ADC result
Wait until flag ADSC becomes 0.
Read result from registers ADCL and then ADCH.
Performing ADC