Analog-Digital and
Digital-Analog
Conversion
CHAPTER - 5
Analog Signals and Digital Signals
  Analog Signals
     Signal that vary continuously throughout a defined range.
     Representative of many physical quantities, such as temperature and
      velocity.
     Usually a voltage or current level.
Digital Signal
   Signals that take on specific values only.
   Required for operation with digital logic.
   A representative of physical quantities by a series of binary numbers.
Most physical quantities are analog in nature. Almost all sensors have
analog outputs. Due to advancements of digital signal processing, most of
data processing is accompanied by digit computers. The data processed by
digital computers are again required to be connected to analog form.
Generally, following steps are followed in digital processing:
   Convert real world analog inputs to digital forms
   Process digital information
   Convert digital output back to real world analog form
The process of changing analog input to equivalent digital form is
accomplished using analog to digital converter (ADC) and the process of
changing digital signal to analog form is accomplished using digital to
analog converter (DAC)
Digital to Analog Converter (DAC)
 In general, a DAC consists of resister, voltage switch, resistive
 summing network and amplifier.
                                  Registive
                     Voltage
                                                   Amp
          Register                Summing
                     Switch
                                  Network
 Convert
 signal
Register: Simple parallel in parallel out register used. On receiving the
external convert signal, the digits can be fed into input of DAC. The input
word is latched and remains there until another convert command in
initialized.
Voltage switch: The output of register is fed to voltage switch and
depending on inputs signal voltage switch provides connectivity to Vref or
ground voltage.
Resistive summing network: It is a network of resistors that provides
resistance inversely proportion to significance of bit.
Amplifier: It converts current to voltage and provides voltage scaling.
Types of ADC
    Binary weighted resistor network
    R- 2R Ladder network
    Current mode
    Voltage mode
Binary weighted resistor
network/weighted resistor type
  “Weighted Resistors” based on bit are used. This reduces current by a factor of 2 for
  each less significant bit. Inputs in volts are weighted in the summing to produce the
  corresponding analog voltage.
Switch
When input bit is 1, switch is connected to Vref
When input is 0, switch is connected to ground
For inverting op-amp,
V0 = - { (Rf/R1)V1 +(Rf/R2)V2 + (Rf/R3) V3}
For binary code of 101, the LSB B0 and the MSB B2 are connect to reg voltage
while this digit B1 are connected to ground terminal.
V0 = - Rf * Vref * {B2/R + B1/R +B0/4R}
B2 = 1, B1 = 0 , B0 = 1
V0 = -Rf * Vref/R {1+0 + ¼}
If Rf = R, Vref = 5V
V0 = -5*{5/4 } = -25/4
In General,
For, 111
V0 = -5{1/4 +1/2 +1}
   = -35/4 V
1LSB = FSO/2n -1 = - (35/4)/ 23 -1 =-5/4V
Resolution = Vref/ 2n
= 5/ 8
Advantages
   Simple
   Easily implemented
Disadvantages
   All resistors may not be available
   Requires wide range of resisters
   For n>4, it is impractical
   Resistance of switch must be small
   Vref must be stable and constant
This approach is not satisfactory for a large number of bits because it
requires too much precision in the summing resistors. This problem is
overcome in the R-2R network DAC.
An R-2R Ladder is a simple and inexpensive way to perform digital to
analog conversion, using repetitive arrangements of precise resistor
networks in a ladder-like configuration.
The R-2R ladder is inexpensive and relatively easy to manufacture,
since only two resistor values are required (or even one, if R is made
by placing a pair of 2R in parallel, or if 2R is made by placing a pair of
R in series). It is fast and has fixed output impedance R. The R-2R
ladder operates as a string of current dividers, whose output accuracy is
solely dependent on how well each resistor is matched to others.
   Small inaccuracies in the MSB resistors can entirely solve by the
    contribution of the LSB resistors. This may result in non-monotonic
    behavior at major crossings, such as from 011112 to 100002
   R-2R ladder network solves the problem of binary weighted DAC. It
    requires only resistors of two values. It can be easily modified to
    add additional bits- each bit requires 2 resistors, values R and 2R
   All input bit pass through a resistance of 2R. The LSB signal must pass through
    more resistor before reaching the op-amp.
   The current divides by a factor of 2 at each mode.
For MSB =01
Req = 2RII2R +2R =3R
So, I = Vref/3R
Va = (I/2)2R = (Vref/2*3R)2R = Vref/3
V0 = (1+Rf/R1)Va = (1+R/2R)Vref/3
V0 = Vref/2
For 00,
Req =3R
I =Vref/3R
Va = {Vref/(3R*4)}*2R
    = Vref/6
V0 = (3/2)Va = Vref/4
V0 = Vref/2n (2n-1 Sn-2 + 2n-2 Sn-2 +…..+S0)
Advantages
   Only 2 resistor values
   Easier implementation
   Easier to manufacture
   Faster response time
Disadvantage
   More confusing analysis
   May result in non-monotonic behavior at major crossings, such as from 01111 2 to
    100002
Performance characteristics of DAC or
DAC specification
     Resolution
     Settling Time
     Linearity
     Speed
     Errors
Resolution: Resolution is the amount of variance on output voltage for every change
of the LSB in the digital input. Resolution defines how closely we can approximate
the desired output signal (higher resolution means finer detail i.e smaller voltage
division)
Resolution = VLSB = Vref/2N
Settling Time: The time required for the input signal voltage settle to the expected
output voltage (within +- VLSB) is called settling time. Any change in input state
will not be reflected in the output state immediately. This time lag between the two
events is settling time.
Linearity: Linearity the difference between the desired analog output and the actual
output over the full range of expected values. Ideally, a DAC should produce a linear
relationship between a digital input and the analog output, this is not always the case.
Speed: Speed means rate of conversion of a single digital input to its analog
equivalent. Conversion rate
Depends on clock speed of the input signal
Depends on settling time of converter
Errors: Error is the difference between expected ideal output and actual obtained
output.
Following are common errors in DAC
1)Non-linearity
   Differential Non-linearity
   Integral Non-linearity
2) Gain Error
3) Offset Error
4) Non- monotonicity
DAC Formula
V0 = (Vref/2n-1)(Rf/R)*D
V0 = (Vref/2n )*D
VLSB = (Vref/ 2n)*1
VLSB = Vref/ 2n (Step size or resolution)
VMSB = Vref/ 2n * 2n-1 = Vref/2
VFS = Vref/ 2n * (2n - 1)
    = VLSB (2n - 1)
% regulation = (Step size/VFS)* 100%
Analog to Digital Converter (ADC)
 Methods
    Successive approximation method
    Ramp method
    Dual ramp method
    Flash type ADC
1)   Successive Approximation Method ADC
Successive approximation ADC is most widely used ADC on account
of its high resolution and speed. It makes direct comparison between
input signal and reference voltage(signal). DAC provides reference
voltage in steps (discrete). The control logic modifies the content of
register bit by bit until register data are digital equivalent of analog
input, VA
                         start
                 Clear all bits
                  Start at MSB
                    Set bit=1
                        Is
                      DAC                                  yes
                                              Clear bit back to
                      output                          0
                       >Vs
                     No
                   No
                        Have all
Go to next              the bits
                        checked
lower bit
                                   yes
             Conversion finished, number in
                        register
                        End
Example: For a four bit conversion 1000 is generated and analog value of
1000 is compared with input.
If input >Output of DAC, then 1 is retained.
If input < Output of DAC, then 1 is flipped to a 0
Then in next clock cycle, the second bit is changed to 1 and whole cycle
is continued till every bit is flipped and checked.
Advantages
   Conversion time is faster than dual slope ADC but slower than that of
    flash type ADC.
   It has fixed conversion time for any value
Disadvantages
   Higher resolution successive approximation ADCs will be slower
   Input must remain constant
Ramp Method of ADC
It is also known as analog to digital conversion using voltage to time conversion.
This type of ADC utilizes digital counter techniques to measure the time required for a
voltage ramp to rise from zero to the input voltage level. The comparator compares the
input voltage against the linearly increasing ramp voltage. Ramp voltage is generated by a
ramp generator which is basically an integrator circuit. A binary counter is activated that
counts ramp steps until ramp voltage equals or exceeds the input voltage. The output of
the counter is then the digital word representing conversion of the analog input.
Operation of Ramp
   Compare input against a linearly increasing ramp voltage.
   A binary counter is activated that counts ramp steps until ramp voltage greater
    than or equal to input voltage.
   The output of counter is then the digital world representing binary I/P.
Advantage: Simple
Disadvantage: Slow
Dual Slope (Dual Ramp) ADC
Dual slope ADC is used in digital voltmeter and other type of measuring instrument.
A ramp generator is used to produce dual slope characteristics. A ramp generator is an
integrator circuit. The conversion begins with the switch connected to input signal. If
analog input is positive, output of integrator (Ramp generator) will be a ramp with
negative slope.
Output voltage (V)= -1/RC ᶴ Vin.dt
                                             = T*Vref/RC
When the positive ramp reaches zero volts, it causes comparator to switch output
thereby stopping the counter. The binary count stored in the counter register is
proportional to analog voltage.
Advantages:
   Greater noise immunity than other ADC type.
   High accuracy
Disadvantage:
   Slow
   High precision external components required to achieve accuracy.
Flash Type/Comparator Type/Parallel ADC/ Simultaneous ADC
It is the fastest ADC that utilizes comparators, which compares reference voltage unit
analog input voltage. A priority encoder is used to convert output of comparators to
digital.
For a n-bit ADC, it requires ‘2n-1’ comparators, so it is very expensive. Its conversion
time is less and can even digitize video signals.
Advantage:
   It is very fast
   Simplest in concept
   Clock is not required
   Its conversion time is less and can even digitize video signals
Disadvantage:
   Requires (2n -1) comparator for n-bit
   Expensive and high power consumption
ADC Specification
   Range of i/p voltage
   i/ ompedance
   Accuracy
   Conversion time
   Format of digital o/p