Analog/Digital Conversion Analog Signals Interacing a microprocessor-based system to the real world. continuous range x(t) Analog and digital signals he bridge: Sampling heorem Conversion concepts Conversion circuitry he real world is analog. Signals vary continuously with time. Analog signals take arbitrarily many values. Examples: audio signal rom microphone or cassette player video signal rom VC or video camera x/y voltage outputs rom joystick time Digital Signals Analog vs. Digital v 6 v 5 v 4 v 3 v 2 v 1 x(t) time With digital signals, it is possible to: he microprocessor world is digital. Limited number o separate (discrete) values at each time step. Digital signals take only these values, nothing inbetween. Computers: wo values ( or 1) corresponding to low/high value o property (usually voltage). In general: 2 n values (n-bit representation).
Signal Conversion o interace microprocessors to real-world (analog) systems, we need converters. Digital to Analog Converters (DAC): Convert a digital input (e.g. binary word) to analog output (e.g. current or voltage). Analog to Digital Converters (ADC): Convert an analog input to digital output. mechanical analog mic mechanical speaker ADC DAC digital µp Analog to Digital Conversion Ideal 2-bit ADC Input range: Analog voltage between and V max Output: 2-bit code analog input voltage V max ¾ V max ½ V max ¼ V max 1 1 11 digital output Conversion o Signals over ime Sampling Sample n-bit n and ADC analog hold analog digital Must hold input signal while converting. Sample and hold circuit takes in (samples) analog value and holds it still while A to D conversion is taking place. What is the minimum rate S at which the analog input should be sampled? Minimum sampling rate S determines the minimum acceptable speed o A to D conversion. Sampling rate must be high enough so that no inormation is lost. What is the inormation o a signal?
A Simple Case Going Faster S = 2/3 S = 1/3 ½ 5/3 2 Detecting a sinusoidal signal o requency at least = 1/ What is the minimum sampling rate required or detection? Fast Enough More han Enough 2 4 3
Sampling heorem Harmonic analysis Signals can be expressed as weighted sums o harmonic unctions. Shannon s heorem (Nyquist Sampling heorem) o sample a bandlimited signal x(t) with no loss o inormation, the sampling rate must be at least twice the requency o the highest requency component. Example: Audio signals typically include components up to 2KHz. CDs sample at 44.1KHz. DAs sample at 32, 44.1, or 48KHz. Basic Converter Characteristics esolution: Fraction o analog range as deined by the number o bits on the digital side o the converter. An n-bit ADC divides analog voltage range [, V max ] into sections and its resolution is o V max. Error: Dierence between analog value you believe a digital value represents and what that analog value actually is. Even ideal converters introduce some error. Quantization Error Accuracy analog input V max ¾ V max ½ V max ¼ V max 1 1 11 quantization error Inherent in converting continuous values to a inite number o discrete values. Every voltage in the range [1/2 V max, ¾ V max ) is mapped to 1. o minimize worst-case error, we assume that 1 means V max. Worst-case error is. Absolute error depends on and. For normalization, quantization error is expressed in terms o the ideal analog dierence represented by a unit change in the digital value, reerred to as LSB. Quantization error is always equal to /- ½ LSB. V max ¾ V max ½ V max ¼ V max non-linearity 1 1 11 non-linearity Absolute non-linearity: Absolute deviation rom ideal transer curve. Dierential non-linearity: Deviation o the dierence between two consecutive codes rom ideal 1 LSB. An absolute non-linearity o /- ¼ LSB results in dierential non-linearity o /- ½ LSB. What happens i non-linearity exceeds /- ½ LSB? non-linearity
Conversion ime Amount o time rom changing input value to output value becoming stable (typically in the ns to µs range). ADCs Sample and hold: May (or not) rely on external sample and hold. Averaging: Code represents average input over conversion time. ypically provide end o conversion signal that can be used as an interrupt. rick question: o achieve sampling rate S, what is the maximum acceptable ADC conversion time? DACs Conversion time usually reerred to as the settling time required or output to reach speciied accuracy. Most DACs can be driven aster than speciied conversion rate at a corresponding loss o accuracy. DAC #1: Voltage Divider Din 2 2-to-4 decoder Fast Size (transistors, switches)? Accuracy? Monotonicity? Vout DAC #2: /2 Ladder 2 ADC #1: Flash Vin 2 2 2 2 priority encoder 3 D3 (MSB) D2 D1 D (LSB) Size? Accuracy? Monotonicity? (Consider 111 -> 1) Iout Vcc 2 1 2 Dout
ADC #2: Single-Slope Integration ADC #3: Successive Approximation (1/2) Vin Vcc I C done DAC Dout EN* n-bit counter CLK Start: eset counter, discharge C. Charge C at ixed current I until Vc > Vin. How should C, I, n, and CLK be related? Final counter value is Dout. Conversion may take several milliseconds. Good dierential linearity. Absolute linearity depends on precision o C, I, and clock. Vin CLK control n successive approximation register Binary search to match input voltage. Conversion time > n times DAC settling time. Input should stay stable throughout conversion. Successive Approximation Algorithm Binary search algorithm. Set successive approximation register to 1. For each bit rom MSB to LSB do 2. lip bit to 1 3. i DAC output > Vin, reset bit to Example = 15V, Vin = 1V, 4 bits, binary code = voltage value iteration DAC out comparison A 3 A 2 A 1 A