V 0.21 Digital Signal Processing Vref 0 Time Analog signal (time varying, continuous) Analog-to- Digital Converter (ADC) 0x030, 0x4A, 0x12, 0xAF, etc.

Slides:



Advertisements
Similar presentations
Analog to digital converter
Advertisements

Analog to Digital Conversion (ADC)
Analog-to-Digital Converter (ADC) And
Sensors Interfacing.
V 0.21 Audio Record/Playback Maxim 517 Audio mini jack OUT0 DIP Switch + - Vout DAC LM386PIC RA0/AN0 I2C bus Open for record Closed for playback EEPROM.
Digital to Analog and Analog to Digital Conversion
Digital Fundamentals Tenth Edition Floyd Chapter 12.
CE 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Analog to Digital (and back again) Interfacing a microprocessor-based system.
Lecture 9: D/A and A/D Converters
10/23/2003ME DAC Lecture1 DAC Sunij Chacko Pierre Emmanuel Deliou Thomas Holst Used with modification.
Interfacing Analog and Digital Circuits
5-1 Analogue Input/Output Many sensors/transducers produce voltages representing physical data.  To process transducer data in a computer requires conversion.
Slides created by: Professor Ian G. Harris Inputs and Outputs PIC Vcc RA3 RA4 RA5  Make an LED toggle state when button is pressed  Need to read RA3,
Data acquisition and manipulation
Explain the introduction to ADC, ADC characteristics, Programming ADC using PIC18, Introduction to DAC and DAC interfacing with PIC18.
Interfacing with the Analog World Wen-Hung Liao, Ph.D.
ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.
Embedded Systems Development and Applications
Introduction to Data Conversion
Analog to Digital Converters (ADC)
EET260: A/D and D/A converters
Analog-to-Digital Converters
Analogue Input/Output
CMOS VLSIAnalog DesignSlide 1 CMOS VLSI Analog Design.
PH4705/ET4305: A/D: Analogue to Digital Conversion
Digital to Analog and Analog to Digital Conversion
Digital to Analog Converters
Data Converters ELEC 330 Digital Systems Engineering Dr. Ron Hayne
V 0.21 Timers A timer on a  C is simply a counter The input clock frequency to a timer can be prescaled so that it is some fraction of the system clock.
ACOE2551 Microprocessors Data Converters Analog to Digital Converters (ADC) –Convert an analog quantity (voltage, current) into a digital code Digital.
Digital to Analogue Converter
Analog to Digital conversion. Introduction  The process of converting an analog signal into an equivalent digital signal is known as Analog to Digital.
Data Acquisition Systems
ELN5622 Embedded Systems Class 7 Spring, 2003 Aaron Itskovich
Analog to Digital Converters (ADC) Ben Lester, Mike Steele, Quinn Morrison.
AD/DA Conversion Techniques - An Overview J. G. Pett  Introductory tutorial lecture for :- ‘Analogue and digital techniques in closed-loop regulation.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
CHAPTER 19 Data Conversion. Objectives Describe and Analyze: Analog vs. Digital Signals Resolution Digital-to-Analog Conversion Analog-to Digital Conversion.
Digital to Analog Converters (DAC) 1 Technician Series ©Paul Godin March 2015.
Analog-to-Digital and Digital-to-Analog Conversion
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
PREPARED BY V.SANDHIYA LECT/ ECE UNIT- 3 APPLICATIONS OF OP-AMP 1.
Analog/Digital Conversion
Chapter 11 Data Acquisition and Manipulation The aims of this chapter are to introduce: the main features of a data acquisition system; the characteristics.
Digital to Analog Converter (DAC)
Embedded Systems Design 1 Lecture Set C Interfacing the MCS-51 to: –D/A Converter –A/D Converter.
Digital-to-Analog Analog-to-Digital Week 10. Data Handling Systems  Both data about the physical world and control signals sent to interact with the.
0808/0809 ADC. Block Diagram ADC ADC0808/ADC Bit μP Compatible A/D Converters with 8-Channel Multiplexer The 8-bit A/D converter uses successive.
EKT 314/4 WEEK 9 : CHAPTER 4 DATA ACQUISITION AND CONVERSION ELECTRONIC INSTRUMENTATION.
Digital-to-Analog Analog-to-Digital
Lecture Notes / PPT UNIT III
Analog-Digital Conversion. Other types of ADC i. Dual Slope ADCs use a capacitor connected to a reference voltage. the capacitor voltage starts at zero.
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
Residential Audio & Video Systems Copyright © 2005 Heathkit Company, Inc. All Rights Reserved Presentation 15 – Digital Audio and Video.
Digital to analog converter [DAC]
MECH 373 Instrumentation and Measurements
Digital-to-Analog Analog-to-Digital
What is a DAC? A digital to analog converter (DAC) converts a digital signal to an analog voltage or current output DAC.
Analog-Digital Conversion
Digital-to-Analog Analog-to-Digital
Created by Luis Chioye Presented by Cynthia Sosa
ECE 354 Computer Systems Lab II
Lesson 8: Analog Signal Conversion
PIC18F458 Analog-to-Digital
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC) Read. Homework #13 and Lab #13 due next week. Quiz.
Digital to Analog Converters (DAC)
Conversation between Analogue and Digital System
ADC and DAC Data Converter
Chapter 7 Converters.
ADC and DAC Data Converter
Presentation transcript:

V 0.21 Digital Signal Processing Vref 0 Time Analog signal (time varying, continuous) Analog-to- Digital Converter (ADC) 0x030, 0x4A, 0x12, 0xAF, etc. Incoming samples  Processor performs computation 0x0B3, 0x23, 0xCF, 0x78, etc. Outgoing samples 0 Time Vref new waveform Digital- to-Analog Converter (DAC)

V 0.22 Applications Audio –Speech recognition –special effects (reverb, noise cancellation, etc) Video –Filtering –Special effects –Compression Data logging

V 0.23 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 Vref (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

V 0.24 Digital-to-Analog Conversion For a particular binary code, output a voltage between 0 and Vref DAC D[7:0] Vout Vref Assume a DAC that uses an unsigned binary input code, with 0 < Vout < Vref. Then D= Vout = 0V D= Vout = Vref(1/256 ) (one LSB) D = Vout = Vref(2/256)... D = Vout = Vref(255/256) (full scale)

V 0.25 DAC Output Plot /256 Vref Input code 2/256 Vref 3/256 Vref 4/256 Vref Vout Output signal increases in 1 LSB increments.

V 0.26 Typical DAC Output From

V 0.27 DAC Architecture Operational Amplifier can be used to sum voltages. From

V 0.28 DAC Architecture (cont) Note ratios of resistors This is a binary code From

V 0.29 DAC Architecture (cont) A 3-bit DAC, called an R/2 N R DAC. Resistors are scaled by powers of 2 (this is hard to do in practice). From

V Another View Resistance values are still R, 2R, 4R From

V R/2R DAC Via circuit analysis, can prove this is an equivalent circuit. Now only need resistances of R, 2R – this is easy to do. This is the most common DAC architecture. From

V Commercial DACs Either voltage or current DACs –Current DACs require an external operational amplifier to convert to voltage Precision up to 16-bits Key timing parameter is settling time - amount of time it takes to produce a stable output voltage once the input code has changed We will use an 8-bit voltage DAC with an I2C interface from Maxim semiconductor

V DAC Application Vertical Deflection Horizontal Deflection Electron Beams (Red, Green Blue) Phosper Grid Cathode DAC Red Green Blue R G B High speed video DACs produce RGB signals for color CRT

V A 1-bit ADC Vref + - Vin R R Vref/2 Vout=Vdd is Vin > Vref/2 Vdd analog signal Vout=0 if Vin < Vref/2 digital signal comparator

V A 2-bit ADC R R R R Vin 1/4Vref 1/2Vref 3/4Vref C B A A B C D1 D (other codes don’t cares) D[1:0] Encoding logic

V ADC Architectures The previous architectures are called Flash ADCs –Fastest possible conversion time –Requires the most transistors of any architecture –N-bit converter requires 2 N -1 comparators. –Commercially available flash converters up to 12 bits. –Conversion done in one clock cycle Successive approximation ADCs –Use only one comparator –Take one clock cycle per bit –High precision (16-bit converters are available)

V Successive Approximation ADC First, set DAC to produce Vref/2. Output of Comparator is Q[N-1] (MSB) If MSB =1, then Vin between Vref and Vref/2, so set DAC to produce ¾ Vref. If MSB=0, then Vin between Vref/2 and 0, so set DAC to ½ Vref. Output of comparator is now Q[N-2]. Do this for each bit. Takes N cycles. Output is Q[N]. From

V Commercial ADCs Key timing parameter is conversion time – how long does it take to produce a digital output once a conversion is started Up to 16-bit ADCs available Separated into fast/medium/low speed families –Serial interfaces common on medium/low speed ADCs For high-precision ADCs, challenge is keeping system noise from affecting conversion –Assume a 16-bit DAC, and a 4.1V reference, then 1 LSB = 4.1/2 16 = 62  V.

V ADC, DAC Equations ADC: Vin = input voltage, Vref = reference voltage N = number of bits of precision Vin/ Vref * 2 N = output_code output_code/ 2 N * Vref = Vin 1 LSB = Vref/2 N DAC: Vout = output voltage, Vref = reference voltage, N = number of bits of precision Vout/ Vref * 2 N = input_code input_code/ 2 N * Vref = Vout 1 LSB = Vref/2 N Vin Vref output code N ADC Vout input code N DAC Vref

V Sample ADC Computations If Vref = 5V, and the 10-bit A/D output code is 0x12A, what is the ADC input voltage? output_code/2 N * Vref = (0x12A)/2 10 * 5 V = 298/1024 * 5 V = 1.46 V (Vin) If Vref = 5V, and the upper 8 bits of the A/D output code is 0xA9, what is the ADC input voltage? output_code/2 N * Vref = (0xA9)/2 8 * 5 V = 169/256 * 5 V = 3.3 V (Vin) If Vref = 4V, and the A/D input voltage is 2.35 V, what is the ADC output code, upper 8-bits? Vin/ Vref * 2 N = 2.35 V/ 4 V * 2 8 =.5875 * 256 = = 150 = 0x96

V Sample DAC Computations If Vref = 5V, and the 8-bit input code is is 0x8A, what is the DAC output voltage? input_code/2 N * Vref = (0x8A)/2 8 * 5 V = 138/256 * 5 V = 2.70 V (Vout) If Vref = 4V, and the DAC output voltage is 1.25 V, what is the 8-bit input code? Vout/ Vref * 2 N = 1.25 V/4 V * 2 8 = * 256 = 80 = 0x50 (input_code)

V PIC18 A/D PIC18F242 has onboard A/D –Successive approximation –10 bit resolution –Reference voltage can be Vdd or separate voltage –Multiple input (more than one input channel) –Time per bit(Tad) for conversion is either 2Tosc, 8Tosc, or 32 Tosc, where Tad cannot be less than 1.6 us (Tosc = 1/Fosc) Total conversion time is 10* Tad +Taq (acquisition) –Taq is approximately 20 us; acquisition time is the amount of time input capacitor requires to charge up to input voltage. –So a 20 Mhz Fosc, Tosc =.05 us, so 32Tosc = 1.6 us; conversion time = 10*1.6 us + 20 us = 36 us.

V Input Pins Analog input channels (AN0,AN1, AN4) Can be analog input channels or Vref+/Vref-

V A/D Block Diagram Channel select analog mux. Vref+/Vref- select

V Acquisition Time Acquisition time is the time required for the analog input voltage to be sampled by the input capacitor. The sampling switch is CLOSED during this time. When the conversion begins, the sampling switch is OPENED and the input capacitor holds the input voltage while the conversion is done. This process is also called sample and hold.

V Voltage References Stability of voltage reference is critical for high precision conversions. We will use Vdd as our voltage reference for convenience, but will be throwing away at least two bits of precision due to Vdd fluctations. Example Commercial voltage reference: 2.048v, 2.5v, 3v, 3.3v, 4.096v, 5v (Maxim 6029) 5V VddVref 4.096v Key parameter for a voltage is stability over temperature operating range. Need this to be less than ½ of a LSB value.

V PIC A/D Registers ADCON0, ADCON1 – configuration registers –ADCON1 used to configure port A for analog/digital inputs, voltage reference –ADCON0 used for clock selection, analog input selection, start/finish conversion status. ADRESH, ADRESL -10-bit results returns in two registers –10-bit result can be configured to be left or right justified. ADRESH : ADRESL DDDDDDDD DD Left justified ADRESH : ADRESL DD DDDDDDDD Right justified

V MAXIM 517 DAC Not present on Max517, Vref instead. R/2R DAC I2C interface Personalizes device address

V Max517 I2C Transaction First byte: Device address Second Byte: DAC command byte Third Byte: output byte to DAC

V Device Address Format For Max517, bits [7:3] = If AD1:AD0 tied to gnd then address is: = 0x58

V Command Format Only command byte we will use for Max517 will be = 0x00 as this does a write to DAC0.

V Timing Max517 DAC has a 6 us settling time. Requires 3 bytes over I2C bus to write a new value. At 400Khz, one bit time = 2.5 us. Each byte is 8 bits + 1 ACK. So 27 bits * 2.5 us = 67.5 us not counting software overhead. So we are limited by I2C bus speed, not by the DAC settling time.

V Testing the ADC and DAC PIC RC4/SDI/SDA Maxim 517 OUT1 This diagram assumes that 10K pullups are already on the SCL/SDA lines from the previous lab. RC3/SCK/SCL OUT0 Vdd AD1 AD0 If you have trouble distinguishing which 8-pin DIP in your parts kit is the MAX517, look for the Maxim symbol on the package. RA0/AN0 Vdd 10K Pot. Analog out, To multimeter or scope Analog input SDA SCL Read the voltage from the potentiometer via the PIC A/D, write this digital value to the DAC. The DAC output voltage should match the potentiometer voltage.

V Potentiometer Vdd A variable resistor. Tie outer two legs to Vdd/GND. Voltage on middle leg will vary between Vdd/GND as potentiometer is adjusted, changing the position of the wiper on the resistor.

V dactest.c /* A/D Setup */ /* all bits input */ TRISA = 0xFF; /* A0 analog input, others digital,right justification of result */ ADCON1 = 0x8E; /* sampling freq = Fsoc/32, channel 0 */ ADCON0 = 0x80; /* turn on ADC*/ bitset(ADCON0,0); printf("ADC is configured!!!"); pcrlf(); A/D Configuration

V dactest.c (cont.) int adc_value; for(;;) { bitset(ADCON0, 2); /* start conversion */ /* wait for end of conversion */ while (bittst(ADCON0,2)); /* read result */ adc_value = 0; adc_value = adc_value | (ADRESH << 8); adc_value = adc_value | (ADRESL); printf("%x",adc_value); pcrlf(); dac_value = ((adc_value >> 2)) & 0x00ff; /* now write to DAC */ update_dac(dac_value); } Read from A/D, print Only write upper 8 bits to DAC This is a 10-bit value!!!

V dactest.c (cont.) #define DAC 0x58 /* I2C DAC */ void update_dac(unsigned char val) { i2c_WriteTo(DAC); i2c_PutByte(0x00); i2c_PutByte(val); i2c_Stop(); } device address byte DAC command byte DAC output byte

V Modifications to dactst.c Modify dactest.c to provide four functions: Multiply by 2 Vnew = Vold << 1 Divide by 2 Vnew = Vold >> 1 Invert Vnew = Vref-Vold Clipped Vmax Vmin ‘if’ tests to check if Vold in range

V What do you have to know? Vocabulary DAC R/2N architecture ADC Flash, Successive approximation architectures PIC A/D –How to configure –Acquisition, Conversion time –How to start do conversion, read result Max517 DAC usage