Analog-to-Digital Conversion Terminology analog: continuously valued signal, such as temperature or speed, with infinite possible values in between digital:

Slides:



Advertisements
Similar presentations
Interfacing to the Analog World
Advertisements

Analog to Digital Conversion (ADC)
Analog-to-Digital Converter (ADC) And
Analogue to Digital Conversion By Cap’n Tim Johnson, PE Prepared 11/12/2013.
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
Digital to Analogue Conversion
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
Digital to Analog and Analog to Digital Conversion
©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 14 Connecting with Analog.
Announcements Assignment 8 posted –Due Friday Dec 2 nd. A bit longer than others. Project progress? Dates –Thursday 12/1 review lecture –Tuesday 12/6 project.
4-Integrating Peripherals in Embedded Systems (cont.)
A/D and D/A. Overview Introduction oDefinitions oOp amps -- a quick review Digital-to-analog conversions Analog-to-digital conversions Reading: Text,
Data Acquisition Concepts Data Translation, Inc. Basics of Data Acquisition.
5/4/2006BAE Analog to Digital (A/D) Conversion An overview of A/D techniques.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Lecture 9: D/A and A/D Converters
Analogue to Digital Conversion
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.
DIGITAL SYSTEMS TCE INTERFACING WITH ANALOG DEVICES (Week 12)
Data acquisition and manipulation
Interfacing with the Analog World Wen-Hung Liao, Ph.D.
Analog to Digital Converters (ADC)
EE174 – SJSU Lecture #4 Tan Nguyen
EET260: A/D and D/A converters
Digital Signal Processing (DSP) Fundamentals. Overview What is DSP? Converting Analog into Digital –Electronically –Computationally How Does It Work?
Railway Foundation Electronic, Electrical and Processor Engineering.
Railway Foundation Electronic, Electrical and Processor Engineering.
PH4705/ET4305: A/D: Analogue to Digital Conversion
Digital to Analog and Analog to Digital Conversion
Week #7 Data Acquisition System, Part (A)
Computer Data Acquisition and Signal Conversion Chuck Kammin ABE 425 March 27, 2006.
1 Sensors and Measurements Penderia & Pengukuran ENT 164 Signal Processing Elements Hema C.R. School of Mechatronics Engineering Northern Malaysia University.
1 4-Integrating Peripherals in Embedded Systems (cont.)
MICROPROCESSOR INPUT/OUTPUT
Digital to Analogue Converter
Lecture 13 A/D Converter & D/A Converter. Outline Basic Operation Single Scan Mode Continuous Scan Mode Group Scan Mode Interrupt Sources Registers D/A.
Data Acquisition Systems
ELN5622 Embedded Systems Class 7 Spring, 2003 Aaron Itskovich
Revised: Aug 1, ECE 263 Embedded System Design Lessons HC12 Analog-to-Digital (ATD) Converter System.
EE121 John Wakerly Lecture #13
CHAPTER 19 Data Conversion. Objectives Describe and Analyze: Analog vs. Digital Signals Resolution Digital-to-Analog Conversion Analog-to Digital Conversion.
The Silicon Laboratories C8051F020
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 4 Standard Single Purpose Processors: Peripherals.
CS224 I/O. Timers Timer1 is 16-bit timer 2^16-1 or 65,535 SYSCLK = 40MHz, Prescalers – 1:1, 1:8, 1:64, and 1:256 – Use T1CONbits.TCKPS=3 for 1:256 scaling.
EKT 221 : Chapter 4 Computer Design Basics
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
Digital System Design using VHDL
Analog/Digital Conversion
Data Acquisition System
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.
EE 319K Introduction to Embedded Systems
Digital to analog converter [DAC]
MECH 373 Instrumentation and Measurements
Digital-to-Analog Analog-to-Digital
Digital-to-Analog Analog-to-Digital
EI205 Lecture 13 Dianguang Ma Fall 2008.
Chapter 10 © 2011, The McGraw-Hill Companies, Inc.
Digital-to-Analog Analog-to-Digital
Lesson 8: Analog Signal Conversion
Lecture 13 A/D Converter & D/A Converter
Conversation between Analogue and Digital System
 Both data about the physical world and control signals sent to interact with the physical world are typically "analog" or continuously varying quantities.
Presentation transcript:

Analog-to-Digital Conversion Terminology analog: continuously valued signal, such as temperature or speed, with infinite possible values in between digital: discretely valued signal, such as integers, encoded in binary analog-to-digital converter: ADC, A/D, A2D; converts an analog signal to a digital signal digital-to-analog converter: DAC, D/A, D2A An embedded system’s surroundings typically involve many analog signals.

Analog-to-digital converters proportionality V max = 7.5V 0V V 1.0V 1.5V 2.0V 2.5V 3.0V 3.5V 4.0V 4.5V 5.0V 5.5V 6.0V 6.5V 7.0V analog to digital t1t2t3 t time analog input (V) Digital output digital to analog t1t2t3 t4 time analog output (V) Digital input Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis

Proportional Signals Simple Equation Assume minimum voltage of 0 V. Vmax = maximum voltage of the analog signal a = analog value n = number of bits for digital encoding 2 n = number of digital codes M = number of steps, either 2 n or 2 n – 1 d = digital encoding a / Vmax = d / M Vmax 0 V 1..1 = 2 n -1 … 0..0 = 0

Resolution Let n = 2 M = 2 n – 1 3 steps on the digital scale d 0 = 0 = 0b00 d Vmax = 3 = 0b11 M = 2 n 4 steps on the digital scale d 0 = 0 = 0b00 d Vmax - r = 3 = 0b11 (no d Vmax ) r, resolution: smallest analog change resulting from changing one bit Vmax 0 V 3=11 2=10 1=01 0=00 r 3=11 2=10 1=01 0=00

DAC vs. ADC DAC: n digital inputs for digital encoding d analog input for Vmax analog output a ADC: Given a Vmax analog input and an analog input a, how does the converter know what binary value to assign to d in order to satisfy the ratio? –may use DAC to generate analog values for comparison with a –ADC “guesses” an encoding d, then checks its guess by inputting d into the DAC and comparing the generated analog output a ’ with original analog input a –How does the ADC guess the correct encoding? DAC Vmax x0 x1 Xn-1 … a

ADC: Digital Encoding Guessing the encoding is similar to finding an item in a list. 1.Sequential search – counting up: start with an encoding of 0, then 1, then 2, etc. until find a match. 2 n comparisons: Slow! 2.Binary search – successive approximation: start with an encoding for half of maximum; then compare analog result with original analog input; if result is greater (less) than the original, set the new encoding to halfway between this one and the minimum (maximum); continue dividing encoding range in half until the compared voltages are equal n comparisons: Faster, but more complex converter  Takes time to guess the encoding: start conversion input, conversion complete output

ADC using successive approximation Given an analog input signal whose voltage should range from 0 to 15 volts, and an 8-bit digital encoding, calculate the correct encoding for 5 volts. Then trace the successive-approximation approach to find the correct encoding. Assume M = 2 n – 1 a / Vmax = d / M 5 / 15 = d / ( ) d = 85 or binary

ADC using successive approximation ½(V max – V min ) = 7.5 volts V max = 7.5 volts. ½( ) = 3.75 volts V min = 3.75 volts ½( ) = 5.63 volts V max = 5.63 volts ½( ) = 4.69 volts V min = 4.69 volts Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Step 1-4: determine bits 0-3

ADC using successive approximation ½( ) = 5.16 volts V max = 5.16 volts ½( ) = 4.93 volts V min = 4.93 volts ½( ) = 5.05 volts V max = 5.05 volts ½( ) = 4.99 volts Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Step 5-8: Determine bits 4-7

Constructing ADC SAR Comparator DAC Vmax Vmin Analog input SAR BUF Digital output State machine SAR: Successive approximation register Timing control

Bit Weight Notice the concept of bit weight in the last example: bit 7 = 7.5 V = 15/2 bit 6 = 3.75 V = 15/4 Each bit is weighted with an analog value, such that a 1 in that bit position adds its analog value to the total analog value represented by the digital encoding. Example: -5 V to +5 V analog range, n=8 Digital BitBit Weight (V) 710/2 = 5 610/4 = /8 = /16 = /32 = /64 = /128 = /256 = 0.039

Bit Weight Example (continued): -5 V to +5 V analog range, n=8 Digital numbers for a few analog values –Values shown increment by 6 bits (weight for bit position 5 is 1.25 V) –Maximum digital number only approximates the maximum analog value in the range Try (-5) + sum of all bit weights Analog (V)Digital (hex) A0 2.5C0 3.75E = FF

Terms & Equations Offset: minimum analog value Span (or Range): difference between maximum and minimum analog values Max - Min n: number of bits in digital code (sometimes referred to as n-bit resolution) Bit Weight: analog value corresponding to a bit in the digital number Step Size (or Resolution): smallest analog change resulting from changing one bit in the digital number, or the analog difference between two consecutive digital numbers; also the bit weight of the Span / 2 n (Assume M = 2 n ) Let AV be Analog Value; DN be Digital Number: AV = DN * Step Size + Offset = (DN / 2 n )* Span + Offset DN = (AV - Offset) / Step Size = (AV - Offset) * 2 n / Span

MPC555 QADC64 QADC64 - Queued Analog to Digital Converter Module analog channels via internal multiplexing 10-bit ADC resolution Converts voltage to an integer value (0-1023) Polling or interrupt driven Programmable channels AN0-ANx

MPC555 QADC64

AN0 AN1 AN2 AN3 ADC CCW Table CCW0 CCW1 … CCW63 A CCW tells the ADC which channel to scan and how long to sample the signal. Result Table Result0 Result1 … Result63 A Result is stored for each scan of a channel when the conversion is complete. QACR1: start a scan by setting SSE bit QASR0: CF flag is set after conv is done

Scan Sequence and Conversion After the ADC is initialized, a sequence of scans is set up as a “queue” in the CCW Table. Each channel to be scanned is added to the queue at successive positions 0, 1, 2, etc. For example: CCW0, CCW1, CCW2, CCW3. –An end-of-queue marker should be added at the next position. The ADC starts the scan and conversion when it is triggered by the enable bit. The ADC reads the CCWs, one after another until end-of-queue is reached, and for each CCW, it converts the signal on the specified channel. –A conversion on a channel stores a result in the respective position of the Result Table, e.g., the result for CCW0 is stored at Result0, etc. When the scan and conversion is complete for all CCWs, then the ADC sets the completion flag to 1. Now all digital results are available to be read from the Result Table.

QADC Interface Programmability using a queue –Scan a few channels quickly –Scan a channel multiple times –Scan large number of channels QACR1 – QADC64 Control Register 1 o16 bit register at 0x30480C oSSE1 – bit 2 – Single Scan enable (bit 0 is MSb) oMQ1 – bits 3-7 oSet to binary to identify Queue 1 QASR0 – QADC64 Status Register 0 o16 bit register at 0x oADC sets a flag when the conversion is done oCF1 – bit 0 – Conversion Complete flag (bit 0 is MSb)

QADC Interface CCW Table otable of Conversion Command Words, where each command word specifies how to perform a scan/conversion operation for an input channel oCCW: 16 bit command word, starting at address 0x304A00 oA queue is a scan sequence of one or more input channels. oA queue is started by a trigger event, which is a way to cause the QADC64 to begin executing the command words. oEach CCW requests the conversion of an analog channel to a digital result. The CCW specifies the analog channel number, the input sample time, and whether the queue is to pause after the current CCW.

QADC Interface Total conversion time: initial sample time, final sample time, and resolution time oInitial sample time – time during which the selected input channel is driven by the buffer amplifier onto the sample capacitor (disabled by means of the BYP bit in the CCW) oFinal sampling period – time to set up DAC array oResolution period – time to convert voltage in the DAC array to a digital value

QADC Interface Result Word Table otable of Result Words, where each result word is the digital result of a conversion oResults from a sequence of conversions are placed in the Result Word Table. oRW: 16 bit result word, starting at address 0x304A80 Programming the QADC: –Reset the ADC queue –Add (to the queue) each analog input channel to be scanned; e.g., four channels, 0 through 3 (AN0-AN3) –Add an end-of-queue marker to terminate the scan sequence –Start a conversion on the ADC, which begins reading each analog input and converting it to a digital value

QADC64 Memory-mapping Layout Module Config. Reg. Port A Data Port A Direction Reg. Control Reg. 0 Control Reg. 1 Control Reg. 2 Status Reg. 0 Status Reg. 1 Port B Data Test Reg. Interrupt Reg. 0x Bit 0Bit 15 0x x x x x30 480A 0x30 480C 0x30 480E 0x x entry 16-bit Conversion Command Word Table (Configurable: one queue or two queues) 0x30 4A00 0x30 4A7E 64-entry 16-bit Result Word Table 64-entry, 16-bit 0x30 4A80 0x30 4AFE The above is the memory-mapping for the 1 st QADC64. The 2 nd QADC64 using different starting addresses.

Programming QADC64 CCW Format: P BYP ISTCHAN Example: Write a CCW into CCW table to scan channel nChannel with no amplifier bypassing and 4-cycle initial sample time (16 cycles in total). nQueueVal = nChannel; nQueueVal = nQueueVal & 0xFF3F; nQueueVal = nQueueVal | 0x0040; *(pCCWTable + nQueue) = nQueueVal;

The Control Registers

The Status Registers CF1Queue1 completion flag PF1Queue1 pause flag TOR1Trigger over-run QSQueue status CWPCommand word pointer

Programming the ADC Initialize the QADC: reset queue to be empty; set up interrupt driven mode, interrupt levels, clock rate. Write into the command word queue (a sequence of A to D conversion commands). In software triggered mode, initiate the conversion by writing into QACR[SSE] bit. Monitor the conversion finished flag (CF). Read the results, and reset CF and PF flags.

Programming QADC64 Example: Reset QADC64 by writing END-OF-QUEUE (63 in decimal) as the first word of CCW table. void QADCR64_Reset() { g_nNumChannels = 0; QADCR64_SetQueue(0, QADCR64_END_QUEUE, QADCR64_QCKL_MAX); } QADCR64_SetQueue : Given CCW entry index, CCW channel/end-of- queue command, and final sample setting, write the corresponding CCW.

Programming QADC64 Example: Start scanning in polling mode (interrupt disabled) –Set up control register 1 void QADCR64_Start_Convert_Poll () { unsigned short * pQACR1; pQACR1 = (unsigned short *) 0x30480C; // Bit 0 CIE1 Conversion Interrupt Enable 0 // Bit 1 PIE1 Pause Interrupt Enable 0 // Bit 2 SSE1 Single Scan Enable 1 // MQ=00001; software triggered single scan mode *pQACR1 = 0x2100; }

Programming QADC64 Example: Determine if all conversions has finished –Checking status register 0 unsigned short QADCR64_Is_Done() { unsigned short * pQASR0; unsigned short nResult; pQASR0 = (unsigned short *) 0x304810; nResult = (*pQASR0 & 0x8000); return nResult; }

QADC Interrupt Sources

QADC64 Interrupt Programming Set up interrupt register (0x for 1 st QADC) IRL1, IRL2: interrupt levels for queue 1 and queue 2, respectively. 5-bit interrupt level: QADC64 is IMB3 device with interrupt level 0-31 (stored in UIPEND). Interrupt is generated at the completion of a CCW if it is the end of queue or has the pause bit set. IRL1IRL2Reserved