Analog to Digital Converter What is ADC Types

  • Slides: 45
Download presentation
Analog to Digital Converter What is ADC ? Types of ADCs HC 11 &

Analog to Digital Converter What is ADC ? Types of ADCs HC 11 & ADC Denis BISSIERES Ian CAMPBELL Yohan LESPERAT Mechatronics - Fall 04

Contents What is ADC ? Types of ADCs HC 11 & ADC • •

Contents What is ADC ? Types of ADCs HC 11 & ADC • • • What is ADC ? Types of ADCs HC 11 & ADC

What is ADC ? Types of ADCs HC 11 & ADC • • Definition

What is ADC ? Types of ADCs HC 11 & ADC • • Definition Examples of use Conversion process Accuracy

Definition What is ADC ? Types of ADCs • Most signals we want to

Definition What is ADC ? Types of ADCs • Most signals we want to process are analog • i. e. : they are continuous and can take an inifinity of values HC 11 & ADC x(t) t

Definition What is ADC ? Types of ADCs • Digital systems require discrete digital

Definition What is ADC ? Types of ADCs • Digital systems require discrete digital data • ADC converts an analog information into a digital information HC 11 & ADC Analog ? Digital System

Examples of use • Voltmeter What is ADC ? Types of ADCs ΔV 7.

Examples of use • Voltmeter What is ADC ? Types of ADCs ΔV 7. 77 V HC 11 & ADC • Cell phone (microphone) Wave Voice

Conversion process What is ADC ? Types of ADCs HC 11 & ADC 3

Conversion process What is ADC ? Types of ADCs HC 11 & ADC 3 steps: • Sampling • Quantification • Coding These operations are all performed in a same element: the A to D Converter

Conversion process: Sampling What is ADC ? Types of ADCs HC 11 & ADC

Conversion process: Sampling What is ADC ? Types of ADCs HC 11 & ADC • Digital system works with discrete states • The signal is only defined at determined times • The sampling times are proportional to the sampling period (Ts) x(t) Ts x(t) xs(t=k*Ts) Ts t

Conversion process: Quantification What is ADC ? Types of ADCs HC 11 & ADC

Conversion process: Quantification What is ADC ? Types of ADCs HC 11 & ADC The signal can only take determined values Belonging to a range of conversion (ΔVr) • Based on number of bit combinations that the converter can output • Number of possible states: N=2 n where n is number of bits • Resolution: Q= ΔVr/N xs(t) xq(t) Q ΔVr Ts t

Conversion process: Coding What is ADC ? Types of ADCs • Assigning a unique

Conversion process: Coding What is ADC ? Types of ADCs • Assigning a unique digital word to each sample • Matching the digital word to the input signal HC 11 & ADC xq(t) N-1 N-2 Q 2 1 0 Ts t ΔVr

Accuracy What is ADC ? Types of ADCs HC 11 & ADC The accuracy

Accuracy What is ADC ? Types of ADCs HC 11 & ADC The accuracy of an ADC can be improved by increasing: • The sampling rate (Ts) • The resolution (Q)

Accuracy xq(t) Q What is ADC ? Types of ADCs t Ts HC 11

Accuracy xq(t) Q What is ADC ? Types of ADCs t Ts HC 11 & ADC Higher Sampling rate Higher Resolution xq(t) Q Ts t t

Sampling rate What is ADC ? Types of ADCs HC 11 & ADC Nyquist-Shannon

Sampling rate What is ADC ? Types of ADCs HC 11 & ADC Nyquist-Shannon theorem: Minimum sampling rate should be at least twice the highest data frequency of the analog signal fs>2*fmax

Sampling rate • Analog signals are composed of an infinity of harmonics What is

Sampling rate • Analog signals are composed of an infinity of harmonics What is ADC ? Types of ADCs HC 11 & ADC • Need to limit the frequency band to its useful part • Use of an analog filter Analog Filter Analog In practice: fs ≈ (3… 5)*ffilter ADC Digital

Example • 8 bits converter: n=8 • Range of conversion: ΔVr=5 V What is

Example • 8 bits converter: n=8 • Range of conversion: ΔVr=5 V What is ADC ? Types of ADCs HC 11 & ADC • Sampling time: Ts=1 ms • Number of possible states: N=28=256 • Resolution: Q=ΔVr/N=19. 5 m. V • Analog Filter: ffilter ≈ fs/5 = 200 Hz 5 255 0 Analog 0 Digital Gain f

Types of ADCs What is ADC ? Types of ADCs HC 11 & ADC

Types of ADCs What is ADC ? Types of ADCs HC 11 & ADC • • Flash ADC Sigma-delta ADC Dual slope converter Successive approximation converter

Flash ADC What is ADC ? Types of ADCs HC 11 & ADC •

Flash ADC What is ADC ? Types of ADCs HC 11 & ADC • “parallel A/D” • Uses a series of comparators • Each comparator compares Vin to a different reference voltage, starting w/ Vref = 1/2 lsb

Flash ADC Comparator is one use of an Op-Amp What is ADC ? Types

Flash ADC Comparator is one use of an Op-Amp What is ADC ? Types of ADCs HC 11 & ADC VIN VREF + - VOUT If Output VIN > VREF High VIN < VREF Low

Flash ADC What is ADC ? Advantages • Very fast • Types of ADCs

Flash ADC What is ADC ? Advantages • Very fast • Types of ADCs HC 11 & ADC • • • Disadvantages Needs many parts (255 comparators for 8 -bit ADC) Lower resolution Expensive Large power consumption

Sigma-Delta ADC Integrator Vin + - What is ADC ? + - Σ Types

Sigma-Delta ADC Integrator Vin + - What is ADC ? + - Σ Types of ADCs 1 -bit HC 11 & ADC Digital Oversampler low-pass filter Sample decimator Serial output DAC • • Oversampled input signal goes in the integrator Output of integration is compared to GND Iterates to produce a serial bitstream Output is serial bit stream with # of 1’s proportional to Vin

Sigma-Delta ADC Advantages Disadvantages What is ADC ? Types of ADCs HC 11 &

Sigma-Delta ADC Advantages Disadvantages What is ADC ? Types of ADCs HC 11 & ADC • High resolution • No precision external components needed • Slow due to oversampling

Dual Slope converter Vin t. FIX tmeas t What is ADC ? Types of

Dual Slope converter Vin t. FIX tmeas t What is ADC ? Types of ADCs HC 11 & ADC • 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 while a counter counts the ADC's output bits. A longer discharge time results in a higher count.

Dual Slope converter Advantages Disadvantages • Input signal is averaged • Greater noise immunity

Dual Slope converter Advantages Disadvantages • Input signal is averaged • Greater noise immunity than other ADC types • High accuracy • Slow • High precision external components required to achieve accuracy What is ADC ? Types of ADCs HC 11 & ADC

Successive Approximation Is Vin > ½ ADC range? What is ADC ? Types of

Successive Approximation Is Vin > ½ ADC range? What is ADC ? Types of ADCs HC 11 & ADC VIN + SAR 1000 0100 If no, then test next bit DAC Out • Sets MSB • Converts MSB to analog using DAC • Compares guess to input • Set bit • Test next bit

Successive Approximation Advantages Disadvantages What is ADC ? Types of ADCs HC 11 &

Successive Approximation Advantages Disadvantages What is ADC ? Types of ADCs HC 11 & ADC • Capable of high speed • Medium accuracy compared to other ADC types • Good tradeoff between speed and cost • Higher resolution successive approximation ADCs will be slower • Speed limited ~5 Msps

ADC Types Comparison What is ADC ? Types of ADCs HC 11 & ADC

ADC Types Comparison What is ADC ? Types of ADCs HC 11 & ADC Type Speed (relative) Cost (relative) Dual Slope Slow Med Flash Very Fast High Successive Appox Medium – Fast Low Sigma-Delta Slow Low

HC 11 & ADC What is ADC ? Types of ADCs • Structure of

HC 11 & ADC What is ADC ? Types of ADCs • Structure of the acquisition • ADCTL Register HC 11 & ADC • Option Register • Data conversion • Acquistion

Structure of the acquisition Port E (analog input) 8 channels PE 0 8 -bits

Structure of the acquisition Port E (analog input) 8 channels PE 0 8 -bits CAPACITIVE DAC WITH SAMPLE AND HOLD AN 0 PE 1 What is ADC ? AN 1 PE 2 Types of ADCs SUCCESSIVE APPROXIMATION REGISTER AND CONTROL AN 2 PE 3 HC 11 & ADC VRH AN 3 PE 4 VRL ANALOG MUX AN 4 PE 5 INTERNAL DATA BUS AN 5 CCF AN 6 PE 7 CA CB CC CD MULT SCAN PE 6 ADCTL A/D CONTROL AN 7 RESULT REGISTER INTERFACE ADR 1 ADR 2 ADR 3 ADR 4 P 64 M 68 HC 11 Family Data Sheet

Structure of the acquisition What is ADC ? 7 6 5 4 3 2

Structure of the acquisition What is ADC ? 7 6 5 4 3 2 1 Types of ADCs HC 11 & ADC 0 • • 8 channel/bit input VRL = 0 volts VRH = 5 volts Digital input on P Port E (analog input) ADR 1 - result 1 Analog Multiplexer A/D Converter Result Register Interface ADR 2 - result 2 ADR 3 - result 3 ADR 4 - result 4

ADCTL Register ADCTL ($1030) CCF Reset to: 0 0 SCANMULT CD CC CB 0

ADCTL Register ADCTL ($1030) CCF Reset to: 0 0 SCANMULT CD CC CB 0 u u u CA u MULT - Single or multiple channel What is ADC ? Types of ADCs HC 11 & ADC 0: Sample a single channel (four times) 1: Sample four channels CD, CC, CB, CA - Channel selection If MULT is 0, then CC-CA bits specify the channel If MULT is 1, then CC specifies the group: 0: Sample AN 0 -AN 3, 1: Sample AN 4 -AN 7 CD is reserved for factory test use CCF - Conversion Complete Flag Set when all four conversions are complete Cleared by writing to ADCTL - starts the next conversion SCAN - Continuous scan mode 0: Take one set of four conversions and stop 1: Continually perform new conversions

ADCTL Register ADR# Behavior Single Channel (MULT = 0) Multiple Channel (MULT = 1)

ADCTL Register ADR# Behavior Single Channel (MULT = 0) Multiple Channel (MULT = 1) Single Conversion (SCAN = 0) One channel converted 4 times consecutively. The results are stored in ADR 1 -ADR 4 4 channels converted once. The results are stored in ADR 1 ADR 4 Continuous Conversion (SCAN = 1) One channel is continuously converted. ADR 1 ADR 4 overwritten 4 channels are continuously converted. ADR 1 ADR 4 overwritten What is ADC ? Types of ADCs HC 11 & ADC

Single Channel 7 6 5 4 3 2 1 0 What is ADC ?

Single Channel 7 6 5 4 3 2 1 0 What is ADC ? Types of ADCs PORT E HC 11 & ADC ADR 1 – Result 1 A/D Converter Result Register Interface ADR 2 – Result 2 ADR 3 – Result 3 ADR 4 – Result 4

Multiple Channels 7 6 5 4 3 2 1 0 What is ADC ?

Multiple Channels 7 6 5 4 3 2 1 0 What is ADC ? Types of ADCs PORT E HC 11 & ADC ADR 1 – Result 1 A/D Converter Result Register Interface ADR 2 – Result 2 ADR 3 – Result 3 ADR 4 – Result 4

ADCTL Register Conversion Sequence E Clock cycles: What is ADC ? Types of ADCs

ADCTL Register Conversion Sequence E Clock cycles: What is ADC ? Types of ADCs HC 11 & ADC Bit 7 (4) 6 (2) _ (2) 0 (2) End (2) Sample (12) ADCTL write (1) Successive approximation 1 st, ADR 1 0 2 nd, ADR 2 32 3 rd, ADR 3 64 4 th, ADR 4 96 CCF 128 total

ADCTL Register A/D Result Registers (ADR 1 – ADR 4): What is ADC ?

ADCTL Register A/D Result Registers (ADR 1 – ADR 4): What is ADC ? Types of ADCs HC 11 & ADC ADR 1 = $1031 ADR 2 = $1032 ADR 3 = $1033 ADR 4 = $1034

ADCTL Register A/D Channel Assignment What is ADC ? Types of ADCs HC 11

ADCTL Register A/D Channel Assignment What is ADC ? Types of ADCs HC 11 & ADC P 447 Reference Manual

ADCTL Register ADR# Behavior What is ADC ? Types of ADCs Single Channel The

ADCTL Register ADR# Behavior What is ADC ? Types of ADCs Single Channel The Channel is selected by CA, CB, HC 11 & ADC (MULT = 0) CC Multiple Channel (MULT = A) The group of Channels is selected by CC only

Option Register Options Register ($1039) ADPU What is ADC ? Types of ADCs Bit:

Option Register Options Register ($1039) ADPU What is ADC ? Types of ADCs Bit: 7 CSEL 6 IRQE 5 DLY 4 CME 3 CR 1 2 1 CR 0 0 HC 11 & ADC ADPU = A/D power up CME = Clock Monitor CSEL = Clock Select Bit 2 = not implemented IRQE = Config. IRQ CR 1 = COP Timer Rate DLY = Enable start-up delay CR 2 = COP Timer Rate

Option Register ADPU - A/D Charge Pump What is ADC ? Types of ADCs

Option Register ADPU - A/D Charge Pump What is ADC ? Types of ADCs HC 11 & ADC 0: Turn off the A/D 1: Turn on the A/D (by enabling the charge pump) Note: Wait at least 100 microseconds before using the A/D (This is 200 cycles at a 2 MHz E-clock) CSEL - A/D Clock select 0: Use the E-clock for the A/D 1: Use a special internal A/D clock that runs at around 2 MHz Note: If the E-clock is 750 KHz or higher, CSEL should be 0. Otherwise CSEL should be 1. DLY – Delay 0 = No delay is used and MCU resumes within approx. 4 cycles. 1 = 4000 E clock cycle delay imposed to allow crystal stabilization

Data conversion What is ADC ? Bit 7 6 5 4 3 2 1

Data conversion What is ADC ? Bit 7 6 5 4 3 2 1 Bit 0 50% 25% 12. 5% 6. 25% 3. 12% 1. 56% 0. 78% 0. 39% Volts (2) 2. 500 1. 250 0. 625 0. 3125 0. 1562 0. 0781 0. 0391 0. 0195 Volts (3) 1. 65 0. 825* 0. 4125 0. 2063 0. 1031 0. 0516 0. 0258 0. 0129 % (1) Types of ADCs HC 11 & ADC (1) %of VRH-VRL, (2) VRH=5 VRL=0, (3) VRH=3. 3 VRL=0 Page 41 of the programming reference guide

Data conversion What is ADC ? Types of ADCs HC 11 & ADC MAX

Data conversion What is ADC ? Types of ADCs HC 11 & ADC MAX : • . 1111 =. FF 16 = 0. 9960937510 = 99. 6093 % Resolution : • . 0000 0001 =. 0116 = 0. 0039062510 = 0. 3906 % MIN : • . 0000 = 016 = 010=0 %

Data conversion What is ADC ? Types of ADCs HC 11 & ADC Some

Data conversion What is ADC ? Types of ADCs HC 11 & ADC Some additional notes: • • 0 V <= analog input <= 5 V Charge pump allows VRH max 6 -7 V VRL and VRH convert to $00 and $FF Digital input of Port E pins not recommended during A/D sample time

Acquisition OPTION ($1039) ADPUCSELIREQ DLY CME ADCTL ($1030) CCF What is ADC ? OPTION

Acquisition OPTION ($1039) ADPUCSELIREQ DLY CME ADCTL ($1030) CCF What is ADC ? OPTION ADCTL ADR 1 ORG Types of ADCs HC 11 & ADC LOOP WAIT 0 SCANMULTCD 0 CR 1 CR 2 CC CB CA EQU $1039 EQU $1030 EQU $1031 $1040 ADPU=1, CSEL=0 LDAA #$80 STAA OPTION LDY #$411 A NOP Delay for charge pump to stabilize 100µs NOP DEY BNE LOOP LDAA #$00 SCAN=0, MULT=0, CHAN GRP=00 STAA ADCTL LDX #ADCTL Wait until CCF or bit 7=“ 1” BRCLR 0, X #$80 WAIT LDAA ADR 1 Read and store result PSHA JSR $4000 SWI END

Acquisition Subroutine output to the screen the decimal equivalence of the stack : What

Acquisition Subroutine output to the screen the decimal equivalence of the stack : What is ADC ? Types of ADCs HC 11 & ADC ORG PULY PULB CLRA LDX IDIV STAB XGDX TBA $4000 #$000 A $0001 First Integer Division Store remainder of the first division Second Integer Division JSR LDAA JSR PSHY RTS $FFB 5 $0001 $FFB 5 $0000 $FFB 5 Subroutines Outrhlf, convert to ASCII Number and output to screen first the hundreds number, the tens and then units number Store result to ACCA and remainder to memory of the second division (NOTE: Remember that ACCA is the high byte of ACCD and ACCB is the low byte of ACCD. Return address used for JSR and RTS is stored in INDEX Y in the subroutine) A number between 000 and 255 will be print on the screen. If it is 255 -> 100 % 000 -> 0 %

What is ADC ? Types of ADCs HC 11 & ADC Questions ?

What is ADC ? Types of ADCs HC 11 & ADC Questions ?