L19 & 20_ADC_DAC

L19 & 20_ADC_DAC - ADC DAC ECET 209 – Lecture 19...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ADC / DAC ECET 209 – Lecture 19 Introduction to Microcontrollers Overview • Introduce Analog and Digital Converters ECET 209 Purdue University 2 Digital vs. Analog • Digital is represented by two values – A logic 1 or a logic 0 • Analog values are continuous – Can take any value in a given range – Exact value is significant ECET 209 Purdue University 3 Digital vs. Analog • Most values are analog in nature – – – – – Temperature Speed Position Sound Etc • Digital systems are used to process information ECET 209 Purdue University 4 Digital vs. Analog • Digital systems are used to process info – Somehow need to convert an analog value into a digital value – Perform digital operations on the data – Somehow need to convert the digital results back into an analog quantity ECET 209 Purdue University 5 Digital vs. Analog • Digital systems are used to process info • A couple Major Examples – CD’s – MP3’s – DVD’s ECET 209 Purdue University 6 Digital vs. Analog micro ADC ECET 209 DAC Purdue University 7 ADC & DAC • ADC – Analog to Digital Converter • DAC – Digital to Analog Converter • ADC and DAC operations are required at the input and output from a digital processing system that deals with analog quantities. ECET 209 Purdue University 8 Analog/Digital Characteristics • Performance Criteria – – – – Resolution Sampling Rate Speed Linearity ECET 209 Purdue University 9 Analog/Digital Characteristics • Resolution – Smallest change in voltage represented by digital code • Sampling Rate – Number of times per second a conversion occurs • Speed – Determined by the time required to perform conversion • Linearity – Accuracy in the conversion throughout the range ECET 209 Purdue University 10 Analog/Digital Characteristics • Resolution – Smallest change in voltage represented by digital code ECET 209 Purdue University 11 Analog/Digital Characteristics • Sampling Rate – Number of times per second a conversion occurs n? ECET 209 Purdue University 1 second 12 Analog/Digital Characteristics • Speed – Determined by the time required to perform a conversion • Conversion Time – time required to complete the measurement • Access Time – time from start until the result is on the output • Settling Time – time for the analog to settle after a digital change ECET 209 Purdue University 13 Analog/Digital Characteristics • Linearity – Accuracy in the conversion through the range ECET 209 Purdue University 14 Analog/Digital Characteristics • Linearity – Accuracy in the conversion through the range ECET 209 Purdue University 15 Analog/Digital Devices • There are numerous ADC’s and DAC’s – Characteristics will determine which one to use • • • • • • Costs Resolution Speed Accuracy (Linearity) Interface ( serial interface or parallel ) etc – Application determines which one to pick ECET 209 Purdue University 16 Analog to Digital Converter • Resolution is a function of the maximum voltage and the number of data bits in the result ECET 209 Purdue University 17 Analog to Digital Converter • Resolution of the ADC is: resolution = Vin_max / 2^n – 1 • Example ( Vin_max = 10 Volts with 8 bits) resolution = 10 / 255 = 0.03921 => or approximately 40mV per bit when using 8-bits of accuracy ECET 209 Purdue University 18 8-bits vs. 10-bits • A system with 10-bits of data vs. a system with only 8-bits of data is 4 times more resolution. • Remember, 2^power • In this case, the power is 2 and therefore the difference is a factor of 4. ECET 209 Purdue University 19 Analog to Digital Converter micro ADC Single wire Analog input ECET 209 Purdue University 20 Analog to Digital Converter Single bit to start a conversion micro ADC ECET 209 Purdue University 21 Analog to Digital Converter Single bit that signals when valid data is available micro ADC ECET 209 Purdue University 22 Timing Diagram for ADC Convert Data Ready Data Bus ECET 209 Valid Data Valid Data Purdue University 23 Analog to Digital Converter micro ADC ECET 209 10-Bits of digital data Purdue University 24 Analog to Digital Converter micro ADC ECET 209 Purdue University 25 Analog to Digital Converter micro ADC ECET 209 Vin / resolution = digital output Purdue University 26 Analog to Digital Converter What if, we only wanted 8-Bits of digital data ? micro ADC ECET 209 Purdue University 27 Analog to Digital Converter micro ADC Use only upper 8-Bits of digital data ECET 209 Purdue University 28 Reading the ADC Only using the upper 8-Bits micro *Assuming ADC is connected to PORTA ADC analog = PINA; ECET 209 Purdue University 29 Reading the ADC Using all 10-Bits micro ADC analog must be an int *Assuming upper 8-bits of the ADC is connected to PORTA & the lower 2Bits are connected to PORTB bits 0&1 analog = PINA; analog = (analog << 2) | (PINB & 0x03); ECET 209 Purdue University 30 Digital to Analog Converter micro DAC ECET 209 Purdue University 31 Digital to Analog Converter micro DAC 8-Bits of Digital Data => Entire Port ECET 209 Purdue University 32 Digital to Analog Converter micro DAC Single wire with an analog voltage ECET 209 Purdue University 33 Digital to Analog Converter micro DAC Digital value x resolution = Analog Out ECET 209 Purdue University 34 Analog and Digital Converter Input and Output Requirements 12-Bits for the ADC & 8-Bits for the DAC micro ADC ECET 209 => 20 total Bits DAC Purdue University 2 1/2 PORTS 35 of total I/O Serial Analog to Digital Converter micro ADC Open for ??? ECET 209 Purdue University 36 Serial Digital to Analog Converter micro DAC Open for ??? ECET 209 Purdue University 37 Internal Analog to Digital Converter ATmega16 microcontroller ADC ECET 209 Purdue University 38 Digital-to-Analog & Analog-to-Digital Part 2 ECET 209 – Lecture 20 Introduction to Microcontrollers How Does a DAC Work? 2R Digital Circuitry MSB 2R 23 2R R + VOUT 22 2R R 21 LSB 2R R 20 2R ECET 209 Purdue University 40 DAC Equivalent Circuit Digital Circuitry MSB 23 22 21 LSB 2 0 V3 2R V2 4R V1 8R V0 2R + VOUT 16R V⎞ V V VV ⎛ V3 V 2 + 1 + 0 ⎟=V + 2 + 1+ 0 ⎜ −V = 2R + OUT 32 ⎜ 2R 4R 8R 16R ⎟ 4 8 ⎝ ⎠ ECET 209 Purdue University 41 How Does an ADC Work? Vin + - 10-Bit DAC AREF ADC Clock Signal ADC Conversion Logic ECET 209 Purdue University 42 ATmega16 Internal ADC ADC0 Channel Selection Multiplexer ADC1 ADC2 ADC3 ADC4 ADC5 ADC6 ADC7 MUX0 + MUX1 MUX2 - ADLAR REFS0 REFS1 AVCC Internal 2.56V Reference 10-Bit DAC System Clock 7-Bit ADC Prescaler AREF System Clock / 2 System Clock / 4 System Clock / 8 System Clock / 16 System Clock / 32 ADC Clock Signal ADC Conversion Logic System Clock / 64 System Clock / 128 ADPS0 ADIF ADPS1 ADPS2 ADCH/ADCL ADEN ADSC ECET 209 Purdue University 43 Analog Input ADC0 Channel Selection Multiplexer ADC1 ADC2 ADC3 ADC4 ADC5 To ADC Input ADC6 ADC7 MUX0 MUX1 MUX2 ECET 209 Purdue University 44 Analog Reference Voltage ECET 209 Purdue University 45 ADC Clock Selection System Clock / 2 7-Bit ADC Prescaler System Clock System Clock / 4 System Clock / 8 System Clock / 16 ADC Clock Signal System Clock / 32 System Clock / 64 System Clock / 128 ADPS0 ADPS1 ADPS2 ECET 209 Purdue University 46 ADC Conversion Result 10-Bit DAC ECET 209 Purdue University 47 Conversion Logic ECET 209 Purdue University 48 Solution Steps ECET 209 Purdue University 49 Lab Next Week ECET 209 Purdue University 50 ...
View Full Document

Ask a homework question - tutors are online