George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.

Slides:



Advertisements
Similar presentations
Interfacing to the Analog World
Advertisements

Analog to Digital Conversion (ADC)
Analog-to-Digital Converter (ADC) And
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
Sensors Interfacing.
Analog to Digital Converters Byron Johns Danny Carpenter Stephanie Pohl Harry “Bo” Marr October 4, 2005.
Digital to Analog and Analog to Digital Conversion
CE 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Analog to Digital (and back again) Interfacing a microprocessor-based system.
4-Integrating Peripherals in Embedded Systems (cont.)
LSU 06/04/2007Electronics 71 Analog to Digital Converters Electronics Unit – Lecture 7 Representing a continuously varying physical quantity by a sequence.
5/4/2006BAE Analog to Digital (A/D) Conversion An overview of A/D techniques.
Shuvra Das University of Detroit Mercy
Analog Comparator Positive input chooses bet. PB2 and Bandgap Reference. Negative input chooses bet. PB3 and the 8 inputs of the A/D. ACME= Analog Comparator.
Lecture 9: D/A and A/D Converters
What is ADC ? Types of ADCs HC11 & ADC Analog to Digital Converter Denis BISSIERES Ian CAMPBELL Yohan LESPERAT Mechatronics - Fall 04.
Analogue to Digital Conversion
Interfacing Analog and Digital Circuits
DIGITAL SYSTEMS TCE INTERFACING WITH ANALOG DEVICES (Week 12)
Data acquisition and manipulation
1 Dr. Un-ki Yang Particle Physics Group or Shuster 5.15 Amplifiers and Feedback: 3.
ECE 371 – Unit 15 Data Acquisition Systems A/Ds in MC9S12DPS56B Microcontroller.
Analog-to-Digital Converter (ADC)
Introduction to Data Conversion
Analog to Digital Converters (ADC)
ADC STUDENT LECTURE Andrew Brown Jonathan Warner Laura Strickland.
EET260: A/D and D/A converters
H. Huang Transparency No.11-1 The 68HC11 Microcontroller Chapter 11: 68HC11 Analog to Digital Converter The 68HC11 Microcontroller Han-Way Huang Minnesota.
Analogue Input/Output
PH4705/ET4305: A/D: Analogue to Digital Conversion
In presenting Order: Josh Navikonis Moiz H Mike Hochman Brian Post Analog-Digital Converters ME /29/2009.
1 Digital to Analog Converter Nov. 1, 2005 Fabian Goericke, Keunhan Park, Geoffrey Williams.
Digital to Analog and Analog to Digital Conversion
Engineering 1040: Mechanisms & Electric Circuits Winter 2015 Analog & Digital Signals Analog to Digital Conversion (ADC)
Data Converters ELEC 330 Digital Systems Engineering Dr. Ron Hayne
ADC & DAC Signal Conversions.
1 ATD10B8CV2 on MC9SI2C By: Yuchun Huang. 2 ADC ADC Power Supply.
ACOE2551 Microprocessors Data Converters Analog to Digital Converters (ADC) –Convert an analog quantity (voltage, current) into a digital code Digital.
Analog to Digital Converters (ADC) 1
Analog to Digital Converter
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
SIGMA-DELTA ADC SD16_A Sigma-Delta ADC Shruthi Sujendra.
Revised: Aug 1, ECE 263 Embedded System Design Lessons HC12 Analog-to-Digital (ATD) Converter System.
Data Acquisition ET 228 Chapter 15 Subjects Covered Analog to Digital Converter Characteristics Integrating ADCs Successive Approximation ADCs Flash ADCs.
High Speed Analog to Digital Converter
1 Data-Converter Circuits A/D and D/A Chapter 9 1.
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
Analog/Digital Conversion
Data Acquisition System
Digital to Analog Converter (DAC)
Analog to Digital Converter (ADC)
Embedded Systems Design 1 Lecture Set C Interfacing the MCS-51 to: –D/A Converter –A/D Converter.
H. Huang Transparency No.10-1 The 68HC12 Microcontroller Chapter 10 68HC12 Analog to Digital Converter.
Lecture Notes / PPT UNIT III
Analog-Digital Conversion. Analog outputs from sensors and analog front- ends (analog signal conditioning) have to be converted into digital signals.
MECH 373 Instrumentation and Measurements
Chapter 12: Analog-to-Digital Converter
EI205 Lecture 13 Dianguang Ma Fall 2008.
Analog-to-Digital Converter
Analog to Digital Converters Electronics Unit – Lecture 7
Created by Luis Chioye Presented by Cynthia Sosa
Lesson 8: Analog Signal Conversion
Digital Control Systems Waseem Gulsher
Conversation between Analogue and Digital System
Analog-to-digital converter
ANALOG TO DIGITAL CONVERTER (ATD).
Chapter 7 Converters.
Presentation transcript:

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume Analog to Digital Converter

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Presentation Outline Introduction: Analog vs. Digital? Examples of ADC Applications Types of A/D Converters A/D Subsystem used in the microcontroller chip Examples of Analog to Digital Signal Conversion Successive Approximation ADC

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Analog Signals Analog signals – directly measurable quantities in terms of some other quantity Examples: Thermometer – mercury height rises as temperature rises Car Speedometer – Needle moves farther right as you accelerate Stereo – Volume increases as you turn the knob.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Digital Signals Digital Signals – have only two states. For digital computers, we refer to binary states, 0 and 1. “1” can be on, “0” can be off. Examples: Light switch can be either on or off Door to a room is either open or closed

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Examples of A/D Applications Microphones - convert pressure waves in the air into varying electrical signals Strain Gages - resistance changes with applied strain Thermocouple - temperature measuring device converts thermal energy to electric energy Voltmeters Digital Multimeters

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Just what does an A/D converter DO? Converts analog signals into binary words

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Analog  Digital Conversion 2-Step Process: Quantizing - breaking down analog value is a set of finite states Encoding - assigning a digital word or number to each state and matching it to the input signal

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Step 1: Quantizing Example: You have 0-10V signals. Separate them into a set of discrete states with 1.25V increments. (How did we get 1.25V? See next slide…) Output States Discrete Voltage Ranges (V)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Quantizing The number of possible states that the converter can output is: N=2 n where n is the number of bits in the AD converter Example: For a 3 bit A/D converter, N=2 3 =8. Analog quantization size: Q=(V max -V min )/N = (10V – 0V)/8 = 1.25V

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Encoding Here we assign the digital value (binary number) to each state for the computer to read. Output States Output Binary Equivalent

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Accuracy of A/D Conversion There are two ways to best improve accuracy of A/D conversion: increasing the resolution which improves the accuracy in measuring the amplitude of the analog signal. increasing the sampling rate which increases the maximum frequency that can be measured.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Resolution Resolution (number of discrete values the converter can produce) = Analog Quantization size (Q) (Q) = V range / 2 n, where V range is the range of analog voltages which can be represented limited by signal-to-noise ratio (should be around 6dB) In our previous example: Q = 1.25V, if we used a 2-bit converter, then the resolution would be 10/2^2 = 2.50V.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Sampling Rate Frequency at which ADC evaluates analog signal. As we see in the second picture, evaluating the signal more often more accurately depicts the ADC signal.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Aliasing Occurs when the input signal is changing much faster than the sample rate. For example, a 2 kHz sine wave being sampled at 1.5 kHz would be reconstructed as a 500 Hz (the aliased signal) sine wave. Nyquist Rule: Use a sampling frequency at least twice as high as the maximum frequency in the signal to avoid aliasing.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Overall Better Accuracy Increasing both the sampling rate and the resolution you can obtain better accuracy in your AD signals.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 A/D Converter Types Converters –Flash ADC –Delta-Sigma ADC –Dual Slope (integrating) ADC –Successive Approximation ADC

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Flash ADC Consists of a series of comparators, each one comparing the input signal to a unique reference voltage. The comparator outputs connect to the inputs of a priority encoder circuit, which produces a binary output

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Flash ADC Circuit

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 How Flash Works As the analog input voltage exceeds the reference voltage at each comparator, the comparator outputs will sequentially saturate to a high state. The priority encoder generates a binary number based on the highest-order active input, ignoring all other active inputs.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ADC Output

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Flash Advantages Simplest in terms of operational theory Most efficient in terms of speed, very fast limited only in terms of comparator and gate propagation delays Disadvantages Lower resolution Expensive For each additional output bit, the number of comparators is doubled i.e. for 8 bits, 256 comparators needed

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Sigma Delta ADC Over sampled input signal goes to the integrator Output of integration is compared to GND Iterates to produce a serial bit stream Output is serial bit stream with # of 1’s proportional to V in

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Outputs of Delta Sigma

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Sigma-Delta Advantages High resolution No precision external components needed Disadvantages Slow due to oversampling

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Dual Slope Converter The sampled signal charges a capacitor for a fixed amount of time By integrating over time, noise integrates out of the conversion Then the ADC discharges the capacitor at a fixed rate with the counter counts the ADC’s output bits. A longer discharge time results in a higher count t V in t FIX t meas

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Dual Slope Converter Advantages Input signal is averaged Greater noise immunity than other ADC types High accuracy Disadvantages Slow High precision external components required to achieve accuracy

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation ADC A Successive Approximation Register (SAR) is added to the circuit Instead of counting up in binary sequence, this register counts by trying all values of bits starting with the MSB and finishing at the LSB. The register monitors the comparators output to see if the binary count is greater or less than the analog signal input and adjusts the bits accordingly

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation ADC Circuit

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Output

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation Advantages Capable of high speed and reliable Medium accuracy compared to other ADC types Good tradeoff between speed and cost Capable of outputting the binary number in serial (one bit at a time) format. Disadvantages Higher resolution successive approximation ADC’s will be slower Speed limited to ~5Msps

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 TypeSpeed (relative)Cost (relative) Dual SlopeSlowMed FlashVery FastHigh Successive AppoxMedium – FastLow Sigma-DeltaSlowLow ADC Types Comparison

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation Example 10 bit resolution or V of Vref Vin=.6 volts Vref=1volts Find the digital value of Vin

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation MSB (bit 9) –Divided V ref by 2 –Compare V ref /2 with V in –If V in is greater than V ref /2, turn MSB on (1) –If V in is less than V ref /2, turn MSB off (0) –V in =0.6V and V=0.5 –Since V in >V, MSB = 1 (on)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation Next Calculate MSB-1 (bit 8) –Compare V in =0.6 V to V=V ref /2 + V ref /4= =0.75V –Since 0.6<0.75, MSB is turned off Calculate MSB-2 (bit 7) –Go back to the last voltage that caused it to be turned on (Bit 9) and add it to V ref /8, and compare with V in –Compare V in with (0.5+V ref /8)=0.625 –Since 0.6<0.625, MSB is turned off

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation Calculate the state of MSB-3 (bit 6) –Go to the last bit that caused it to be turned on (In this case MSB-1) and add it to V ref /16, and compare it to V in –Compare V in to V= V ref /16= –Since 0.6>0.5625, MSB-3=1 (turned on)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Successive Approximation This process continues for all the remaining bits.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Using the Analog to Digital Converter in the MC9S12C32

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Interfaces to external signals via Port AD 10- or 8-bit Successive Approximation ADC

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/ input channels Subsystem operation controlled by ADCTL2-5 Registers Results placed in ATDDR0-7

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Conversion Sequence Power on Wait 20 μs for ATD power to stabilize Sample Successive Approximation End Conversion time –8-bit: ATD Clock Cycles –10-bit: ATD Clock Cycles

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Output StatesDiscretized Voltage Range Binary Coded Equivalent mV $ mV $ mV $02 …… … V $FF MC9S12  8 bits  2 8 = 256 MC9S12 accepts 0 – 5V range Voltage Range = (V RH – V RL )/255 * State

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ATDCTL2 $0082 ADPU: ATD ON (1) or OFF (0) AFFC: ATD Flag clears automatically (1) or Must read status register to clear flag (0) AWAI: ATD off in wait mode (1) or on in wait mode (0) ETRIGLE: External trigger on edge (0) or level (1) ETRIGP: Controls polarity of ext. trigger Falling edge/low level (0) or rising edge/high level (1) ETRIGE: Enables (1) or disables (0) external trigger ASCIE: ATD Sequence Complete Interrupt Enable Bit - Enabled (1) or Disabled (0) ASCIF: ATD Sequence Complete Interrupt Flag - No ATD interrupt occurred (0) or ATD sequence complete interrupt pending (1)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ATDCTL3 $0083 S8C,S4C,S2C,S1C: Set the number of Conversions per sequence FIFO: Conversion results are mapped to corresponding result registers (0) or result registers are used as a rotating First In First Out (FIFO) queue (1) FRZ1,FRZ0: Determine function of ATD system during Freeze mode

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ATDCTL4 $0084 SRES8: 8-bit (1) or 10-bit (0) resolution SMP1,SMP0: Determines length of second part of sample PRS4:0: ATD clock prescaler bits

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Prescaler determines ATD Clock frequency Derived from Bus Clock Frequency

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ATDCTL5 $0085 DJM: Left Justified (0) or Right Justified (1) data in result registers DSGN: Unsigned data in result registers (0) or signed data in result registers (left justification only) (1) SCAN: Single conversion (0) or continuous conversion sequence (1) MULT: Sample only one channel (0) or sample across multiple channels (1) CC,CB,CA: Determine the channel to be sampled if MULT=0 or the first channel to be sampled if MULT = 1

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Left Justified Data

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Right Justified Data

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405

ME4447/6405 ATDSTAT0 $0086 SCF: Conversion Sequence not completed (0) or completed (1) ETORF: External Trigger Overrun Flag - No overrun has occurred (0) or overrun has occurred (1) FIFOR: FIFO Overrun Flag - No overrun has occurred (0) or overrun has occurred (1) CC2:0: Determine the result register that will contain the current conversion

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ATDSTAT1 $008B CCFX: Conversion number X has not yet completed (0) or has completed and the result is available in ATDDRX (1)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ATDDIEN $008D IENX: Disable digital input on PTADX (0) or enable digital input on PTADX

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 PORTAD $008F PTADX: Contains digital input value for port AD pin X

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Example Write a program to configure the ATD system to perform one capture of an analog signal from Channel 0 with an 8-bit resolution

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ORG$1000 LDAA#$80;ADPU=1 STAAATDCTL2 Power on ATD Subsystem ATDCTL2EQU$0082 ATDCTL4EQU$0084 ATDCTL5EQU$0085 ATDDR1HEQU$0092 ATDSTAT1EQU$008B ORG$2000 ADRESULTRMB1 Delay for power to stabilize LDY#160;delay for 20  s DELAY DEY BNEDELAY LDAA#$01;SCAN=0,MULT=0,CC:CA=001 STAAATDCTL5;start conversion LDX#ATDSTAT1;check for complete flag BRCLR 0,X #$02 ;CCF1 is bit 1 LDAAATDDDR1H;read chan. 1 STAAADRESULT;store in result SWI Set ADCTL to start conversion Wait until conv. complete Read result LDAA#$85;SRES8=1, PRESCALER BITS = STAAATDCTL4 8-bit resolution, appropriate prescaler