Fri. Oct 13 Announcements Lab practical next week Review session Monday – materials posted Survey going around: You will be given 5 mins at the end of class to fill it out and hand it into the box up front Please anonymous (I want to know what you really think) As part of the survey, I also want you to write down One thing you learned today One question you have from today’s material (or the class in general)
Analog-to-Digital Converter Module 3.B Analog-to-Digital Converter Tim Rogers 2017
Learning Outcome #3 A: Clocks and Real Time Interrupt (RTI) “An ability to effectively utilize the wide variety of peripherals integrated into a contemporary microcontroller” A: Clocks and Real Time Interrupt (RTI) B: Analog-to-Digital Converter (ATD) C: Serial Peripheral Interface (SPI) D: Timer Module (TIM) E: Pulse Width Modulation (PWM) F: Serial Communications Interface (SCI) How?
Learning Outcome #3 Why? “Analog to digital conversion” The digital world is quantized and has fixed information size On a macro scale, the real world is continuous and analog. ATD
Analog Conversion Basics If your reference voltages are 0V and 5V, and you have 2 bits to encode each sample, then the sampled voltage values possible are: (A) 0, 2.5V (B) 0V, 1.25V, 2.5V, 3.75V, 5V (C) 0V, 1.25V, 2.5V, 3.75V (D) 1.25V, 2.5V, 3.75V, 5V (E) 0, 2.5V, 5V Analog Conversion Basics Rate at which you take samples is called the sampling rate Each reading of the analog signal is a sample Each sample has a finite number of bits: quantization Values always relative to a reference voltage. What you store is a fraction of the reference voltage.
Analog Conversion Basics Design space for ATD converters involves picking the: sample rate # bits for quantization encoder type Analog Conversion Basics Rate at which you take samples is called the sampling rate Each reading of the analog signal is a sample Goal: Reproduce the analog signal as faithfully as possible given constraints and acceptable error Each sample has a finite number of bits: quantization Actually reading the sample to find most appropriate value is called encoding Values always relative to a reference voltage. What you store is a fraction of the reference voltage.
Determining an individual value (sampling) One way to help narrow this sampling time is to use a “sample-and-hold” (S/H) circuit that acts as an ”analog memory” S/H circuit will read in a voltage, then hold that value while the converter makes it binary But in reality, converting the value to a digital value is not infinitely fast Ideally, when we read in a voltage we do it infinitely fast
Setting the Sampling rate If the highest frequency component of the input signal is Fi, what must your sampling frequency (Fs) be to ensure correct conversion? (A) Fs=Fi (B) Fs=Fi/2 (C) Fs=Fi*2 (D) Fs=Fi*4 (E) Fs=Fi/4 Key component of setting up an ATD is setting the sampling rate Ts To do this – you need to do a spectral analysis of your input signal. If the input signal has higher frequency components than Fs/2, you need to put a low-pass filter on the ATD input
If Fs (sampling frequency) = 20kHz an 11 kHz input signal (without any filtering) be encoded as: (A) 10 kHz (B) 11 kHz (C) 9 kHz (D) 21 kHz (E) None of the above ATD Filtering Q: What happens if you do not filter out the high frequency components? A: Aliasing! Original waveform Alias reconstruction In the frequency domain Filter on ATD input referred to as anti-aliasing filter Without a filter, frequencies are “folded back” into the baseband
Quantization Number of bits for each sample: often called dynamic range Quantization is the assignment of a fixed amplitude level (corresponding to an available binary code) to the incoming analog signal Note that the converted code is relative to the reference voltage(s) applied to the converter (VRH = voltage reference high, VRL = voltage reference low)
Illustration of Quantization
Quantizing Intervals and Quantization Error X Vrh X Vrh
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Quantizing Intervals and Quantization Error
Reminder: Block Manual for 9S12 ATD https://engineering.purdue.edu/ece362/Refs/9S12C_Refs/S12ATD10B8CV2.pdf