270 likes | 472 Views
Introduction to Data Conversion. Vocabulary. ADC (Analog-to-Digital Converter ): converts an analog signal (voltage/current) to a digital value DAC (Digital-to-Analog Converter ): converts a digital value to an analog value (voltage/current)
E N D
Vocabulary ADC (Analog-to-Digital Converter): converts an analog signal (voltage/current) to a digital value DAC (Digital-to-Analog Converter): converts a digital value to an analog value (voltage/current) Sample period: for ADC, time between each conversion Typically, samples are taken at a fixed rate VFS / Vref (Full scale or Reference Voltage): Analog signal varies between 0 and Vref, or between +/-Vref Resolution: Number of bits used for conversion (8 bits, 10 bits, 12 bits, 16 bits, etc). Conversion Time: The time it takes for a analog-to-digital conversion
Data Converter Basics • Real world signals are analog (temp, pressure, position, sound, light, speed, etc) : – Continuous time – Continuous amplitude • DSP can only process: – Discrete time – Discrete amplitude Data conversion from analog to digital and digital to analog is needed
Typical embedded application Physical variables (temperature, pressure, light,…) • Real world signals are analog (temp, pressure, position, sound, light, speed, etc) : – Continuous time – Continuous amplitude • DSP can only process: – Discrete time – Discrete amplitude Transducer electrical signals Signal conditioning voltages Analogue-to-digital converter digital signals Because ADC is commonly needed, most modern microcontrollers has an in-built ADC unit. Input ports Processor Output ports Digital-to-analogue converter analogue control signals Actuator
Analog-to-Digital Converter (ADC) • ADC converts an input analog value to an output digital representation. • ADC is operated at a rate of fS samples per second. Anti-alias filter is used to avoid any aliasing phenomena. • ADCs usually require the input be held constant during the conversion process, indicating that the ADC must be preceded by an Sample-and-Hold Amplifier (SHA) to freeze the band-limited signal just prior to each conversion.
ADC Transfer Characteristics • An ideal ADC: • Accepts analog input in the form of either voltage or current • Produces digital output either in serial or parallel form • N = # of bits • VFS= Full scale output • = min. resolvable input 1 LSB = VFS /2N
ADC Resolution • The resolution of a N-bit ADC is a function of how many parts the maximum signal can be divided into. • (Vref+ - Vref-) / 2N Note: VFS = (Vref+ - Vref-) = Full scale output • Where Vref+ is the positive reference voltage and Vref-is the negative reference voltage. • When Vref-= 0 V, we refer to Vref+as simply Vref or VFS • Example: • For Vref = 10V, and N=12, what is 1 LS b? • A 12 bit ADC has a resolution of 212= 4,096. Therefore, our best resolution is 1 part out of 4,096, or 0.0244% of the full scale or 10V / 212 = 2.44 mV • Resolution is the smallest input voltage change a digitizer can capture
ADC : The process • There are two related steps in A-to-D conversion: • Sampling • Quantization • Sampling: • The analogue signal is extracted, usually at regularly spaced time instants. • The samples have real values. • Quantization: • The samples are quantized to discrete levels. • Each sample is represented as a digital value.
Sampling an analogue signal analogue signal sampling points sampling period Ts What is a suitable sampling period for a signal?
The sampling theorem An analogue signal x(t) with frequencies of no more than Fmax can be reconstructed exactly from its samples if the sampling rate satisfies: Fs≥ 2 × Fmax. Significance If maximum frequency of the signal is Fmax, the sampling rate should be at least: If the sampling rate is Fs, the maximum frequency in the signal must not exceed:
Example of signal with fmax = 90 Hz sinusoid sampled Fig 1 Fig 2 Fig 1: Sample fs = 1000 Hz (11xFmax) These samples represent accurately the sinusoid because there is no other sinusoid that can produce the same samples Fig 2: Sample fs = 290 Hz (3.2xFmax) Strange as it seems, it can be proven that no other sine wave can produce the same type of samples Fig 3: Sample fs = 95 Hz (1.05xFmax) Clearly, this is an improper sampling of the signal because another sine wave can produce the same samples The original sine misrepresents itself as another sine. This phenomenon is called aliasing. Fig 3
Quantizing the sampled signal A-to-D converter • Consider an n-bit ADC. • Let Vref be the reference voltage. • Let Vin be the analogue input voltage. • Let Vmin be the minimum allowable input voltage, usually Vmin= 0. The ADC’s digital output, d = Dn-1Dn-2 …D0, is given as The step size (resolution) is the smallest change in input that can be discerned by the ADC: Step size =
Quantizing the sampled signal step size Maximum digital output 23 levels Reference Voltage Vref A 3-bit A-to-D converter
Quantizing the sampled signal quantization error analogue signal quantized signal 8 levels (N =3) sampling points 3-bit ADC sampling period
ADC : Parameters Number of bitsN: The higher is the number of bits, the more precise is the digital output. • Sample timeTsample: A sampling capacitor must be charged for a duration of Tsample before conversion taking place. Quantisation errorEq: The average difference between the analogue input and the quantized value. The quantization error of an ideal ADC is half of the step size. Conversion timeTconv: Time taken to convert the voltage on the sampling capacitor to a digital output.
Digital-to-Analog Converter (DAC) • The digital data is processed by a microprocessor and output to a DAC. • DAC is usually operated at the same rate fS as the ADC • When the application demands, it is equipped with appropriate circuitry to remove any output glitches arising in connection with input code changes. The resulting staircase-like signal is finally passed through a smoothing filter to ease the effects of quantization noise.
DAC Transfer Characteristics • An ideal DAC: • Accepts digital input b1-bN • Produces either analog output voltage or current • N = # of bits • VFS= Full scale output • = min. step size 1 LSB = VFS /2N
ADC Equations Vin = input voltage, Vref+ = ref voltage, Vref-= 0 V, (Note: Vref= VFS) N = number of bits of precision output_code = Vin / Vref * 2N Vin = output_code / 2N* Vref 1 LSB = Vref / 2N
DAC Equations Vout = output voltage, Vref= reference voltage, N = number of bits of precision Input_code = Vout/ Vref * 2N Vout = input_code / 2N* Vref 1 LSB = Vref / 2N
Sample ADC, DAC Computations Example: Given N=3, VFS= 1.6V and input code = 101. Find the output value V0ut Solution: V0 =Δ (b1x22 + b2x21 + b3x20) Δ = VFS /23 = 1.6V / 8 = 0.2V V0 = 0.2V (1x22 + 0x21 + 1x20) = 0.2V x 5 = 1V
Sample ADC, DAC Computations If Vref = 5V, and a 10-bit A/D output code is 0x12A, what is the ADC input voltage? Vin = output_code / 2N * Vref = (0x12A) / 210 x 5 V = 298/1024 x 5 V = 1.46 V (ADC Vin) If Vref = 4V, and an 8-bit A/D input voltage is 2.35 V, what is the ADC output code? output code = Vin / Vrefx 2N = 2.35 V / 4 V x 28 = 0.5875 x 256 = 150.4 = 150 = 0x96 (ADC output code)
Improve the accuracy in ADC • Increase the sampling rate which increases the maximum frequency that can be measured. • Increase the resolution which improves the accuracy in measuring the amplitude of the analog signal.
References: http://www.ni.com/white-paper/4806/en/ Home > Products and Services > White Papers > Understanding Resolution in High-Speed Digitizers/Oscilloscopes http://inst.eecs.berkeley.edu/~ee247/fa10/files07/lectures/L11_2_f10.pdf http://194.81.104.27/~brian/DSP/ADC_notes.pdf ume.gatech.edu/mechatronics_course/ADC_F10.pptx