Analogue Input/Output
Many output devices require variable control, not just two digital logic levels
To control these devices from a computer requires conversion from digital to analogue form (usually an analogue voltage).
The conversion from analogue signals to digital values is performed by Analogue to Digital Converter (ADC) The conversion from a digital value to an analogue signal is performed by a Digital to Analogue Converter (DAC).
5-2
DAC function
Parallel DAC
n bit value
DA Converter
Analogue output
VAgnd
Vref
Serial DAC would typically have a single data input line and a clock input signal which would be used to clock in the serial data stream. Adv. : - Fewer pins.
Analogue Output
5-5
2R
4R
Vref/2
R
Vo = - Vref(Rf/Rinput)
Vref/4
1
Vref d0
AGND
5-6
2n -1 V max n *Vref 2
where n is number of bits VMAX
MAXVAL
Digital Value
5-7
M AX5722 dual,12-bit, low-power, buffered voltage output, digital-to-analog converter (DAC) is packaged in a space-saving 8-pin MAX package (5mm 3mm).
Ultra-Low Power Consumption 112A at VDD = +3.6V 135A at VDD = +5.5V
5-8
Recreate audio
10
Analogue Input
n bit result
VAgnd
Vref
The analogue input voltage is converted into a value. The value is dependent on the reference voltages and the number of bits n.
5-12
Analogue Input
Characteristics
resolution
conversion
method conversion time input voltage range interface parallel (fast) or serial(fewer connections)
5-13
Flash ADC
Consists of a series of comparators, each one comparing the input signal to a unique reference voltage.
The comparator outputs connect to the inputs of a priority encoder circuit, which produces a binary output
5-14
5-15
As the analog input voltage exceeds the reference voltage at each comparator, the comparator outputs will sequentially saturate to a high state.
The priority encoder generates a binary number based on the highest-order active input, ignoring all other active inputs.
5-16
ADC Output
5-17
Flash
5-18
MCP3208
Features 12-bit resolution 1 LSB max DNL 1 LSB max INL (MCP3204/3208-B) 2 LSB max INL (MCP3204/3208-C) 4 (MCP3204) or 8 (MCP3208) input channels Analog inputs programmable as single-ended or pseudo-differential pairs On-chip sample and hold SPI serial interface (modes 0,0 and 1,1) Single supply operation: 2.7V - 5.5V 100 ksps max. sampling rate at VDD = 5V 50 ksps max. sampling rate at VDD = 2.7V Low power CMOS technology: 500 nA typical standby current, 2 A max. 400 A max. active current at 5V Industrial temp range: -40C to +85C Available in PDIP, SOIC and TSSOP packages
5-19
Number of steps (values) = 2n = 28 = 256 steps are numbered 0 to 255 step size = reference voltage range / number of steps = (5v 0v) / 256 = 19.53125 x10-3v 20mv number range 0 to 255 corresponds to voltage range of 0 to 5v ADC value = (Vin / (Vref Agnd)) * 256 : remember max ADC value is 255 so max input voltage that can be converted accurately is less than 5 volts. What is the maximum convertible input voltage?
5-20
255
ADC value
4 3
2
1 V
10mv 30mv 50mv 70mv 20mv 40mv 60mv
Volts
4.98
5-21
Cont.
ADC value 4
5-22
Quantization Error
101 100
011
010
001 0 1 2 3 4 5 6
Each input sample is assigned a quantization interval that is closest to its amplitude height. If an input sample is not assigned a quantization interval that matches its actual height, then an error is introduced into the conversion process.
This error is called quantization error/noise.
One way to reduce quantization noise is to increase the amount of quantization intervals. The difference between the input signal amplitude height and the quantization interval decreases as the quantization intervals are increased (increases in the intervals decrease the quantization noise). Solved by increasing the ADC resolution (number of bit) in proportion to the increase in quantization intervals.
80 70 60 50 40 30 20 10
5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6
8 80 7 70 6 60 5 50 4 40
3 30
2 20 1 10 0
0 5
0 5
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
Example - The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature.
Calibrated directly in Celsius (Centigrade) Linear + 10.0 mV/C scale factor 0.5C accuracy guarantee able (at +25C)
5-25
ADC range (microcontroller) 0V to + 3.3 V LM35 Linear + 10.0 mV/C scale factor Use a basic Centigrade temperature sensor +2C to +150C
LM35 Input
3 2
+ 4
0 - 3V
1
0 - 1.5V
Scale the input voltage accordingly to match input the range of the ADC
5-26
step size = reference voltage range / number of steps = (3.3v 0v) / 1024 = 3.22265625 x10-3v Every 1C is now equivalent to 20.0 mV Temperature resolution > 0.2C
+5V
LM35 Input
3 2
+ 4
0 - 3V
1
AI0
Microcontroller 3.3 V
0 - 1.5V
5-27
ADC input
Good practice to
Limit
D41
+5V R162
To ADC input
BAT54S/SOT
5-28
Interrupt request
Conversion Control
AN0 AN1 M u t i p l e x e r
Busy
Start conversion
Converter
Result Register
ANn
VAREF
VAGND
Reference voltage
5-29
4.
5.
The voltage is presented to the ADC input. The ADC is sent a signal to start conversion While the conversion takes place the input voltage should remain stable. The ADC outputs a signal to indicate that it is busy doing the conversion and should not be disturbed. When the conversion is completed the ADC makes the result available and outputs a signal to indicate that the conversion has completed (e.g remove the busy signal)
5-30
To convert several analogue inputs 1. use an ADC for each input or more usually 2. use one ADC and switch the inputs through a multiplexer
requires selection of input before each conversion is started and a short delay is required before conversion started to allow switching to occur and signal to settle.
while conversion takes place voltage must remain stable sample voltage input connected to S&H voltage held on a capacitor sample time charging time of capacitor input signal disconnected from S&H
5-31
Summary
Analogue inputs are often required in embedded applications and so ADCs are integrated into most microcontrollers (DACs less so) ADCs and DAC also exist as standalone IC devices often specialist devices e.g. High speed or high resolution ADCs, fast DACs for video output. Main characteristics of interest is
resolution
- number of bits voltage range ADC - conversion time DAC - slew rate
5-32
Example question
A 5 bit ADC is used to encode an analogue signal in the range 0V to +5V for linear PCM encoding determine:
The
step size Calculate the percentage resolution Calculate the dynamic range in dB Calculate the input voltage level corresponding 10110.
Solution
1.The step size
Number of steps 25 32
step size 50 156.25 103V 32
1 % Resolution 100 3% 32
Solution
3 Calculate the dynamic range in dB
20 log2 5 30 .1dB
4 Calculate the input voltage level corresponding 10110
5-35
Voice signal
Signal Bandpass Filtering
0 Hz
3,400 Hz
20 kHz
The human voice can produce sounds up to 20 kHz, but most sound is between 300 Hz and 3.4 kHz. The bandpass filter only passes this sound to reduce bandwidth.