AnalogtoDigital Conversion - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

AnalogtoDigital Conversion

Description:

analog: continuously valued signal, such as temperature or speed, with infinite ... For a pure tone (sine wave) with frequency f, f is the bandwidth. ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 20
Provided by: dianet4
Category:

less

Transcript and Presenter's Notes

Title: AnalogtoDigital Conversion


1
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 systems surroundings typically
    involve many analog signals.

2
Analog-to-digital converters
Embedded Systems Design A Unified
Hardware/Software Introduction, (c) 2000
Vahid/Givargis
3
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
  • 2n number of digital codes
  • M number of steps, either 2n or 2n 1
  • d digital encoding
  • a / Vmax d / M

4
Resolution
  • Let n 2
  • M 2n 1
  • 3 steps on the digital scale
  • d0 0 0b00
  • dVmax 3 0b11
  • M 2n
  • 4 steps on the digital scale
  • d0 0 0b00
  • dVmax - r 3 0b11 (no dVmax )
  • r, resolution smallest analog change resulting
    from changing one bit

5
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?

6
ADC Digital Encoding
  • Guessing the encoding is similar to finding an
    item in a list.
  • Sequential search counting up start with an
    encoding of 0, then 1, then 2, etc. until find a
    match.
  • 2n comparisons Slow!
  • 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

7
Digital-to-analog conversion 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. 5/15
d/(28-1) d 85
Encoding 01010101
Successive-approximation method
½(Vmax Vmin) 7.5 volts Vmax 7.5 volts.
½(5.63 4.69) 5.16 volts Vmax 5.16 volts.
½(7.5 0) 3.75 volts Vmin 3.75 volts.
½(5.16 4.69) 4.93 volts Vmin 4.93 volts.
½(7.5 3.75) 5.63 volts Vmax 5.63 volts
½(5.16 4.93) 5.05 volts Vmax 5.05 volts.
½(5.63 3.75) 4.69 volts Vmin 4.69 volts.
½(5.05 4.93) 4.99 volts
Embedded Systems Design A Unified
Hardware/Software Introduction, (c) 2000
Vahid/Givargis
8
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, n8

9
Bit Weight
  • Example (continued) -5 V to 5 V analog range,
    n8
  • 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

10
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 LSb
  • Span / 2n
  • Let AV be Analog Value DN be Digital Number
  • AV DN Step Size Offset DN / 2n Span
    Offset
  • DN (AV - Offset) / Step Size (AV - Offset)
    2n / Span

11
MPC555 QADC64
CCW Table CCW0 CCW1 CCW63
A CCW tells the ADC which channel to scan and how
long to sample the signal.
AN0 AN1 AN2 AN3
ADC
QACR1 start a scan by setting SSE bit
QASR0 conv. is done when CF flag is set
Result Table Result0 Result1 Result63
A Result is stored for each scan of a channel
when the conversion is complete.
12
Advanced Topics in ADC
  • One-shot ADC one analog sample
  • What heating temperature is required?
  • What is the current angle of the crane?
  • What is the humidity level in the greenhouse?
  • Sequential ADC sequences of analog samples
  • How quickly is the car accelerating?
  • How fast is the plane turning?
  • What is the frequency of this sound?
  • Issues
  • Sampling rate
  • Signal filtering

13
Sequential ADC
  • Example
  • Suppose we are required to design a system to be
    used by an environmental organization to record
    and automatically classify the songs of whales
    recorded (underwater) in the Antarctic. Our
    embedded system will be encased in plastic and
    attached to a floating buoy. It will run on
    batteries for a two-year period and will be
    required to send a radio broadcast to base every
    time it detects a whale in the vicinity.
  • We will use an underwater pressure transducer
    (hydrophone) to convert the fluctuations in water
    pressure produced by the whale song into a
    voltage value than can be processed by an ADC.
  • The output of the ADC will be a sequence of
    numbers. Individually, these numbers have no
    meaning it is the sequence of numbers that
    allows us to determine, for example, the
    frequency components that make up the whale song.

14
Whale Song
Original analog signal, recorded as a
continuously varying voltage from an underwater
microphone
Quantized version of same signal
0.46, 0.42, 0.17, 0.04,
Digital representation of song
15
Design Stages
  • Determine required sample rate
  • Speech recognition example To recognize spoken
    words from a speech waveform (using the
    time-varying voltage waveform from a microphone),
    how frequently must the signal be sampled?
  • Sample at a frequency of at least twice the
    bandwidth of the signal (Nyquist frequency)
  • Bandwidth frequency of the highest frequency
    component in the signal being measured
  • For a pure tone (sine wave) with frequency f, f
    is the bandwidth.
  • For a broadband signal having multiple frequency
    components, fi, the bandwidth is the maximum
    signal frequency, fmax.
  • For speech signals, maximum frequency component
    is around 20 kHz, so need to sample at around
    40kHz.
  • Need to remove any higher frequencies with an
    anti-aliasing filter

16
Design Stages
  • Determine required sample rate
  • Speech recognition example this is a signal
    processing system.
  • Control system example e.g., controlling a motor
  • Different method
  • Simplifying assumptions
  • Sample at a frequency inversely proportional to
    the rise time
  • Rise Time the output response time after
    applying an input (e.g., open the throttle and
    measure the how long the engine takes to go from
    a minimum speed to a maximum speed)

17
Design Stages
  • Remove any high-frequency components from input
    signal
  • Need to avoid aliasing
  • For sampling frequency of f, need to remove all
    frequencies above f/2 Hz
  • Example speech in a factory environment
  • 5 kHz bandwidth, 10 kHz sample rate
  • There will be frequencies over 5 kHz these
    frequencies result in an effect called aliasing.
  • Sampling of a high-frequency signal (i.e., one
    with frequency greater than half the sample rate)
    leads to an incorrect result the result is a
    representation for a a different lower frequency
    signal. The two signals are not distinguishable
    after sampling.
  • Anti-aliasing (low-pass) filter is needed before
    sampling the data.

18
Design Stages
  • Determine required bit resolution
  • 3-bit ADC 8 possible signal levels in digital
    representation
  • Error introduced by digitization process is half
    the quantization level
  • 3-bit ADC quantization is 1/8, so error is /-
    1/16 of analog range
  • Quantization noise errors over a sequence of
    samples
  • 12-bit ADC is adequate in most applications

19
Design Stages
  • Select/configure the ADC
  • Sample time for typical ADC 100 ns
  • Sample rate requirement?
  • Hardware overhead
  • Type of ADC
  • Configuration
  • Software overhead
  • Polling vs. interrupts
  • Scan mode
Write a Comment
User Comments (0)
About PowerShow.com