T7 Adc
T7 Adc
Barometer / altimeter
Air pressure.
Audio
… Temperature
Analog to Digital Conversion
World is analog …
but computers deal with digital information.
VREF+
N bits
Vin
ADC Dout
End of conversion
VREF-
Conversion command
Analog versus Digital
N bits
Vref+ 11…1111
Vref+ 11…1110
11…1101
11…1100
2N
Output
Vref-
codes
00…0110
Resolution of ADC = (Vref+ - Vref- )/(2N - 1) 00…0101
00…0100
00…0011
¿Digital codes obtained represent 00…0010
EXACTLY the original analog value? 00…0001
… NO! There’s an ERROR Vref- 00…0000
Quantization error: ± 0.5 LSB
V
00…0100 4 LSB
00…0011 3 LSB
Exact value
Obtained value
00…0001 1 LSB
Resolution
00…0000
t
Ts
Sampling Maximum conversion error = ADCresolution / 2
period
Average conversion error = 0
Devices
Comparator
2. Digital to Analog Converter (DAC)
Possible implementation:
Symbol String Resistor ladder
VREF+
N bits
Vout
Din DAC
VREF-
Convert
D0 D1 D2
2. Digital to Analog Converter (DAC)
Possible implementation:
R/2R Resistor ladder
3. Slope A/D converter
Counter
Register
VREF+
VREF-
4. Successive approximations A/D Converter
(SAR)
ADC: sample and hold + converter
VREF+
Sampling switch
N bits
Vin Rswitch
Converter Dout
CHold
VREF-
ΔT
Vin1 N bits
Vin
ADC
VinP-1
VREF-
M bits
Convert
#Input Select
Symmetrical ADC output
+127 *VIN/VREF
Example of a 8 bits
symmetrical ADC
VIN
-128 *VIN/VREF
The PIC18 A/D Converter
TAD ≥ 1 µs
TACQ ≥ 1.4 µs (but TACQ ≥ 7.45 µs in the example)
TCNV = 11, we need 11 TAD for conversion.
TDIS = 1 TCY cycle
Automatic and manual modes
Procedure for Performing A/D Conversion
The PIC18 D/A Converter
- The PIC18F45K22 has a 5-bit D/A converter.
It is driven by registers VREFCON1
… and VREFCON2
The PIC18 Fixed Voltage Reference
- FVR1 and FVR2 are used in ADC and DAC modules
• Resolution
• Sampling Frequency
Sensors and Resolution
Common usage of ADC is to read information from an
analog sensor, to get the value of a physical magnitude
(e.g. temperature, audio, etc.)
Resolution = A / (2N-1)
Resolution Example
Temperature range of 0 K to 300 K to be linearly
converted to a voltage signal of 0 to 2.5 V, then
digitized with an 8-bit A/D converter
Example 2:
Conversion
order
Obtained
samples
Original signal
vs Sampled version
Aliasing (1D)
Original signal
Reconstructed signal
Samples
Aliasing example
(fsample f signal)
Aliased signal
Aliasing (2D)
Aliased signal
Anti-aliasing filter
+VREF
Low pass filter
N bits
Vin 1 Vin’
ADC
f (Hz)
fcutoff
-VREF
Convert
Anti-aliasing filter
f CLK > 2·fcutoff
Signal characteristics: basic concepts
A periodic signal can be described as a sum of sinusoidal and cosinusoidal
signals (Fourier series decomposition).
f = 1 / T [Hz]
w = 2π f [rad/seg]
Fundamental frequency and harmonics
Amplitude Fundamental frequency (ωo)
Frequency (k·ωo)
Harmonics (k·ωo)
...
Signal’s Frequency Spectrum
Piano spectrum
(note D4)
Audio facts
Range of audible frequencies: 20 Hz to 20KHz (individual depending)
Frequency range of an analog phone call: 350 Hz to 3500 Hz
Violin frequency range: 96 Hz to 10 kHz (approx.)
Temperature control
ADC
ADC
PWM0 PWM1 PWM2
Example Barometric Measurement
The SenSym ASCX30AN Pressure Sensor
1 2 3 4 5 6