THE DIGITAL SOLUTION
Part 10 (final) - Back to the real world
                                                                              By Owen Bishop q                                                                            = 50 pA, which is 128 (Z1
A.    11 t h e articles of this se-
       les have demonstrated
that there is generally an ad-
                                                                                                                                                                         times) the current through Do.
                                                                                                                                                                             In Fig. 78, the digital
vantage to be gained                     In this series we look closely at digital electronics,                                                                           '"put 'S show"             be fed di-
storing, transmitting a n d                                                                                                                                               rectly to the resistors. This is         '
Drocessine data in                          what it is, what it does, how it works, and its                                                                               a workable circuit, but relies
i o m . Maybe there are dGad-                           promise for the future.                                                                                           on the individual bits of the
vantages. too, a n d analogue                                                                                                                                             digital inputs all having pre-           ,
data may sometimes be more                                                                                                                                                cisely the same voltage levels
easily handled, but the over-                                                                                                                                             for '0' and 'l'. It is more usual
all preference is for digital                                                                                                                                            for the digital input to he fed
representation. This prefer-                                                                                                                                              to an array of analogue
ence endures for a s long a s !                                                                                                                                           switches, each connected as in
d a t a is being handled by                                                                                                                                               Fig. 79. If the input hit is 'W,
electronic devices. But ulti- i                                                                                                                                          the switch connects the re-
mately, the d a t a h a s to be !                                                                                                                                         sistor to 0 V. If the bit is 'l',
presented to a human for as- :'                                                                                                                                           the switch connects the re-
sessment, a s tnformation, or                                                                                                                                             sistor to an accurate reference
even simply for entertain-                                                                                                                                                voltage, VEf, which is used for
ment, a n d h u m a n s operate                                                                                                                                           all resistors.
in a n essentially analogue                                                                                                                                                  This converter relies on the
                                                                    -
                                                                                                                                                                         'virtual earth' property of the
                                                                             -   ~~   p    ~
manner. Maybe we can cope
if the decimal number 1 2 is                                                                       Fig. 78                                                                inverting input of the op amp.
presented to u s in binary                                                                                                                                                Current flows to the inverting
form a s 1110, b u t few would                                                                                                                                            input a s if this is a t ground
recognize t h a t the number                                                                                                                                              (0 V) potential. If two or more          1
                                                                                           DIGITAL IN PUT                                                                 inputs are at 5 V, the current
1 1 1 l l 0 0 1011 represents                                                              C,ONTROLS SWITCH
                                                                                                                                                                     /    flowing through one resistor is
the year 1995. Fewer still
would recognize a certain se-
quence of bytes a s one of the
                                                                                      - 1 ,/,      -                                                                 '    independent of the current
                                                                                                                                                                          flowing through the others. As
                                                                                                                      TO
themes from Beethoven's                                                                                              OPAMI                                                a result, the current reaching
Ninth Symphony. Before it                                                                                                                                                 the inverting input is the sum
c a n have much meaning to                                                                                                                                                of the individual currents.
h u m a n s . digital d a t a nearly                                                                     #d012&?0-78                                                      When two or more inputs re-
always needs to he converted                                                                                                                                              ceive a logic 1 input, the cur-
back to analogue form. In                                                                                                                                                 rents are summed, just as the
this final p a r t of the series.                                                                  Fig. 79                                                                value of a binary number
we consider some of the                                                                                                                                                   equal to the sum of the values
many techniques of digital-to-       7, , ,   ~       -   .,L            .            ~    -,I,-
                                                                                               ~               ~.
                                                                                                       ,,,--_C_____J_
                                                                                                                 ~  -    ~              ~   ~   ,.   ,?   ,,,m   =
                                                                                                                                                                          of the '1' digits it contains.
analcgue-     conversion .           '   VREF
                                           -
                                                                         .-                                                       ~..                                     Suppose both Do and D, are at
                                                                                                                                                                         .5 V. The sum of the currents
                                                                                                             p       ~       -
                                             +~   - R ~ - T ~ P - ~ - - - - - - - - ~ R                                  T?R=L                                       1
Weighted resistors                                E                 rr                    5,            'i                   ,-.
                                                                                                                             ,=
                                                                                                                                                                     l    1s 11.71875 pA, which corre-
                                                                                                                                                                          sponds to the the binary value
                                                                                                                                                                                                                   ,
One of the simplest DACs ;                                                                                                                                                 l1 (decimal 3) and is three
makes use of the summing                   ,,                                                                                                                             times the current flowing
abilities of a n o ~ e r a t i o n a l                                          r_R=-                                                                                     when Dn alone is s u.~. ~ l i eIf   d.
amplifier. In Fig. 78, the in-            I       I 1 I      l f-                                                                                                         all eight inputs are high, the
verting input of the amplifier ,
       ~    ~
                                                                                                                                                                          total current is 1111 1111 (255
receives current from a num- ;              I                                 I       NALOGUE                                                                             decimal) times the Do current,
her of sources throunh senar.
                        n     .
                                       9-57 = OlolTAL INPUT CONTROLS SWITCHES A       OUTPUT                                                                              or a .~.~ r o x i m a t e996
                                                                                                                                                                                                   l v u ~ The
                                                                                                                                                                                                            .
ate resistors. Assuming t h a t                                                                                                                                           inputs of an opgmp have ex-
this is an 8-bit converter, the          p
                                                                                                                                                                          tremely high impedance, so
digital value to he converted                                                                                                                                             all the current flows on
is applied to the eight inputs,                                   Fig. 80                                                                                                 through the 1 kR resistor, cre-
Do-D7. The input is a logic                                                                                                                                               ating a p.d. of 1V across it.
level, either 0 V (equivalent to                                                                                                                                          The output voltage swings
logic O), or 5 V (equivalent to when 5 V is applied to i t is to the amplifier from Do is                                                                                 negative of the inverting input
logic 1). The resistors a r e double t h a t flowing through 511280000 = 3.90625 pA. If                                                                                   by 0.996 V. As the binary
weighted, so that each one has the preceding resistor. Thus, 5 V is applied to D,, the cur-                                                                               input ranges from 0 to
a value half t h a t of the one the currents are in proportion rent is 51640000 = 7.8125 pA,                                                                               1111 1111, the analogue out-
preceding i t in the sequence. to the values of successive dig- exactly double (21 times). At                                                                             put ranges from 0 V to
Correspondingly, the current its in a binary number. For the other extreme, the current                                                                                   -0.996 V.
flowing through each resistor example, the current flowing flowing from D? is 5110000                                                                                         The output is now on a n
                                                                                                                                                          ELEKTOR ELECTRONICS OCTOBER 1995
                                                                       ...    .         --        -   - -.   . .          ---,.
                                                                                                                            .
r
                                               .    .-                                       ,,                    -    .
                                                                                            TBe DIGITAL SOLUTION -PART 10 m)
                                                                                                               the switch is in position 1). In
                                                                                                               either case, the current flows
                                                                                                               to a line at zero potential If a
                                                                                                               switch is a t position 0 [corre-
                                                                                                               sponding to a 'V in the data
                                                                                                              byte), the current is lost to
                                                                                                              gmund.Ifamikhisat 1,the
                                                                                                              cmrent flows to the op amp
                                                                                                              and is summed with other
                                                                                                              currents from switches a t po-
                                                                                                              sition 1. This is another type
                                                                                                              of multiplying MC.
                                                                                                                  In Fi.81 we build up an
                                                                                                              R-!?R ladder in stages, to see
                                                                                                              what potentiala are pt-        at
                                                                                                              its rungs. In the network of
                                                                                                              Fig. Ola, the potential a t
                                                                                                              pointAisVmThetwoRre-
                                                                                                              sistors divide the potential
                                                                                                              exactly in half, no the poten-
                                                        W. 81                                                 tial at point B is V&.        In
                                                                                                              Fig. 80b, the single R resistor
                                                                                                              on the right of Fig. 8Oa has
        analogue scale and can, if de-     ever, in many application., put voltnge, can be aet to to been replaced by two 2R re-
        sired, be fed to a voltmeter       the output is fed to a low-pass different levels. In either ver- sistor~in parallel, both of
        calibrated from 0 to 255 to        filter and, if the output is con- mon, the chief disadvantage is which are connected to 0 V.
        give a direct reading. More        tinually changing, the filter that the values of all the Two 2R resistors in parallel
        often it might be used to pto-     smoothes out the steps, pro- larger resistors must be very are exactly equivalent to a
        vide an analogue input to a        ducing an e l k t i d y analogue precise. For example, if the single R resistm, so the poten-
        device such am a motor, con-       output.                            10M is precise to within 10% tial at point B remains a t
        trolling its speed, or to aloud-       This type of DAC is simple (*l M), oll redstots must be V&. In Fig. 8Oc, the 2R re-
        speaker, determining the posi-     in principle and produce~ precise to within +lM. This s i d r at the right of 6g. 80b ia
        tion of the cone. The output is    rapid conversions. Another means that the 1280 M r e replaced by its equivalent, two
        said to be analogue, but this i8   version has the weighted re- aistor must be precise to R resistors in series. They di-
        not quite true. An analogue        sistors in the feedback posi- within 0.078%. A converter of vide the potential at B eraetly
        output could take any value in     tion. These cau be switched in more than 8-bit precision is in half, so the potential a t
        the range 0-0.996 V, but the       or out of circuit by analogue not really a practioal propod- point C is V d 4 . In B'ig. 80dd
        output of this circuit is one of   switches controlled by the tion.                                   the R resistor a t the right of
        256 stepe, spaced 3.90625 mV       digital input. The input to the       A digital-to-analogue con- Fig. 8Oc is replaced by two 2R.
        apart. The reoolubion of the       op amp is at a fixed level, but verter of this type in which resistors in parallel, and the
        converter is 3.90626 mV. How-      the gain, and hence the out- the output is the product of potential a t C remains a t
                                                                              the digital input and a refer- V d 4 . Thin p-B       cau be re-
                                                                             ence voltage source is often peated indefinitely, producing
                                                                             known as a multiplying DAC.      more and more 2R runge, the
                                                                                                              chain of R resistors always
                                                                             Switched current-                ending in a 2R resistor tied to
                                                                                                              0 V. At each rung, the poten-
                                                                             SOUK8 DAC                        tial is exactly half that of the
                                                                             This type of converter also rung above it. Since the 2R re-
                                                                             uses the current-summing sistors are cennected to 0 V
    I                                                                        property of an op amp, but the whatever the position of the
                                                                             circuit for producing the cur- switches, the switch positions
                                                                             rents is entirely different h have no effect on the poten-
                                                                             the weighted resistors used in tial. When a switch is set to
                                                                             the previous converter. In position 1, a corresponding
                                                                             Fig. 80, the current sources current flows to the op amp.
                                                                             are provided by what is This current is V&m,
                                                                             known as an R2R ladder, be- V&4R. VBBP/8R,and so on
                                                                             earn it consists af resistors of along the ladder to V&56R
                                                                             only two values, R and 2R. a t the last rung of an 8-bit
                                                                             Current flows from the volt- chain. It is feasible to con-
                                                                             age reference along the chain tinue the ladder to give 12-bit
                                                                             of R resistoFs (except the one m 16Et mwlution. Whatever
                                                                             a t the end, which is 2R) and the length of the ladder, the
                                                    JP JP-                   aemss the 2R resistors, which op amp snme the current flow-
                                                   =        T-               form the rungs of the ladder. ing through the 1 switches,
                                                                             The current flows through producing an output ranging
                                                                             switches controlled by the from 0 V to -V&                as the
                                                                             digital input and then goes input (in an 8-hit converter)
                                                                             either to ground (if the swich ranges from 0 to 11111111.
                                                                             is in position 0) or to the in-     This is one of the most pop
                    341-89                                 W-  84            verting input of the op amp (if ular types of converter. It is
        ELEKmRELEmROMLS~ER19M
m         GENERAL INTEREST
easv to produce i n integrated I                                                                                                        I
clrcuit form, mainly because i t
requires on-chip resistors of 1                              SUMMER                                                                     1
only two values. More signifi-                                                                                       OUTPUTTO DAC
cant i s t h e fact t h a t i t i s not         ro 1151                    I-ORATOR              OUINTIZER
t h e absolute values of t h e re-
sistors t h a t matter, only their
relative values. This is easy to
achieve, allowing high preci-
sion a t low cost.
Switched capacitor
                                                            -1                        FEEOBACX
                                                                                                              1
DAC                                                                                                           9LW.       -   ..-..
One of the newer forms of DAC L                                                        ~ ~-    -~      P-P    ~                         ~ ~     ~
relies on switched weighted
capacitors. Instead of using a                                                           Fig. 85                                                <
chain of resistors connected in
series a s a potential divider,
                                                                                                                              ,
these DACs use a ladder of ca-                             SUMMER
pacitors connected in parallel.
The principle of the technique                                                                       ONE sn             OUTPUTTO
i s illustrated i n Fig. 82.                                                                                            LOW - P A S S
                                                                                                   ouANnzER
                                                                                                                        F,,,,
which for simplicity is ahown                                                                                           (bit $,,ell
a s a 4-hit DAC. The analoeue   U
switches are controlled by two
clocks, which in t u r n produce                                                                                     I
high pulses. When clock 1                                                 DELAYED
goes high, all switches a r e
                                          ~
                                                                        FEEDBACK
connected to t h e 0 V line, so
all capacitors a r e discharged. i
Next, clock 2 goes high a n d 1
t h i s operates i n conjunction l
with t h e dieital inout so t h a t
only those switches corre-                                                               Fig. 86
sponding to a 'l' input bit a r e
connected to the V.,c.L, line. The                                      l                                                                 1
switches corresponding to a VOLT= VREFxCB/(Ca+CB).
digital '0'remain connected to
t h e 0 V line. However, t h i s Given t h a t
does not mean t h a t they re- CA= 3Cl4 and CB= 5C14,                          FROM
                                                                               m,TcTm=a,
                                                                                                                    - . TO    ANA LOGUE
                                                                                                                          -....
                                                                                                                         ",a",,".  ..
main uncharged. To see what
happens, suppose t h a t t h e VOW= VREF~[3C1411([3C141t[5C141) OAC
digital input is 0110. Switches
Do and D3 remain switched to = VREFx3/(3+51
t h e 0 V line, while D1and D2
                                                                                                             1 ,
become switched to t h e VREF =VREFx3I8.                                                   ,A,                        <X
line. I t makes t h e situation
easier to understand if the cir- The input is 0110 (decimal 6 )
                                                                                                                     940120-10-86
cuit i s redrawn a s in Fig. 83. and t h e output is 318 of VKEp
The two capacitors on the left T h e relationship between                      - --                                       --- -
                                                                                                                                            i   4
a r e those switched to VREF. input and output becomes
T h e t h r e e capacitors a t t h e clearer if we express the out-                                    Fig. 87
right a r e those switched to the put i n sixteenths, since there
0 V line, and include the non- a r e sixteen possible switching
switchable Cl8 capacitor a t combinations with four capac- on fewer bits but to take sam- duction of audible sound,
t h e end of the ladder.             itors. Then, t h e output is writ- ples more frequently. Taking though i t has t h e advantage
     The two groups of capaci- t e n a s 6116. If t h e binary samples more frequently than t h a t i t is easier to filter out
tors in Fig. 8 3 a r e capacitors i n p u t i s n, t h e output is "116 i s required to represent t h e t h e quantization noise which
in parallel, so they can be of VREpThis can be confirmed analogue d a t a accurately i s results from t h e fact t h a t , a s
thought of a s being replaced by working out t h e effects of known a s ouersampling. For mentioned earlier, the output
by a single capacitor for each other binary inputs. Note that example, digital audio re- from a DAC i s stepped, not
group. Since they are in paral- since this DAC has no op amp, quires sampling a t a little continuous. T h e frequency of
lel, their equivalent values are the maximum output is VREp over 40 kHz (usually 44.1 kHz) this noise extends around the
found by adding their capaci-                                             i n order to represent all fre- sampling frequency, so i s
tances. Figure 84 shows the usingfewer bits                               quencies in the audio range much easier to remove when
equivalent circuit a s a capaci-                                          up to 20 kHz, t h e highest fre- t h e sampling frequency i s
tive potential divider. I t can We have mentioned t h e prob- quency t h a t can be detected higher, well separated from
be shown t h a t when two ca- lem of obtaining the required by t h e human ear. Sampling t h e audio frequencies. There
pacitors CAa n d CB form a po- degree of precision in the most a t a higher rate, such a s a r e practical problems i n
tential divider (Fig. 841, t h e significant bits. An entirely 88.2 kHz, i s oversampling. I t taking advantage of oversam-
output V,, is                        different approach is to rely does not improve t h e repro- pling when producing CDs,
                                                                                                      ELEKTOR ELECTRONICS OCTOBER 1995
  -
                                                                                                               -
                                                                                 THE D I G W SOLUTION PART 10 W A L )
                             output, follow the stages in
but it is podble to effectively
 double the sampling rate on converting a &bit digital            Input + ficedb.elr          -m                          Fndb.cL
replay by interpolating a sam-
                             value, reducing it to l-bit out-
ple between each of the      put. Given that the 4bit input       0101+0000=0101                     1                 0101-1000=-0011
recorded samples. The value  has 1000 (decimal 8) as its          0101-0011=0010                   0                   001(M000=+0010
 of each interpolated sample is
                             maximum value, the quan-             0101+0010=0111                   1                   0111-1ooO-OOO1
 calculated as the mean of the
                             tizer gives an output '0' for        0101-0001=0100                     1                 0100-1ooO-0100
two recorded samples on      values OO00-0011 and an o u t        0101-0100=0001                   0                   OOO1-0000=+0001
 either aide of it. Interpolation
                             put 'l' for values 0100-1000.        0101+0001=0110                     1                 011&1000=-0010
 was widely used in earlier  Because it drops three bits,         0101-0010=0011                   0                   0011-0011
                             the M C cycles at 8 (-29) times
 digital audio systems, but in                                    0101+0011=1OOO                     1                 1000-1000= 0000
 now largely replaced by sys-the initial eampling frequency.
terns that rely on fewer bits.
                             What happens is shown in
     Figure 86 is a block dia-
                             Table 8.                                                         -8
  gram of a circuit that reduces At the fist cycle, there is
                             no existing feedbaeh, the total
 the number of bits in the sam-
 ples by 2. The digital inputis between 0100 and 1000, so
  consists of samples, each of n
                             the output is '1'. This 'l' is      beset analogue circuits. It             Converted?
  bits, taken a t the sampling
                             really a 'l' plus three follow-     might be objected that the nig-         In this series we have de-
 rate f (say, 44.1 kHz). The ing bits which have been dis-       nal is still digital after it           scribed and explained many
  sample is fed to an integrator,
                             carded, so it is equivalent to      leaves the converter, but aU            aspects of digital electronics
 which digitally adds the sam-
                             1000. Thie is subtracted from       that is now needed is a low-            and we have attempted to
 ple ta the value alreadythere.
                             the input+feedback value to         pass filter of simple design to         show that digital techniques
  The sum is then requantized,
                             give the feedback (-0011) for       wnvert the stream of bits (re-          have many benetits. Analogue
  that is, the final two bitsare
                             the sewnd cycle. In the secxlnd     member, these are wming at a            techniques have a lot to offer
                             cycle, the feedback is added ta
  removed from it. In effect, it is                              very high rate) into an ana-            and may be preferable in
                             the input (which is held at the
  divided by 4 and the remain-                                   logue signal. No further con-           many situations but, on the
  der discarded. This becomessame value as before). The          uersion, as such, is needed.            whole, the author believes
                             feedback value is negative so
  the output of the circuit. The                                 Assuming, for the sake of sim-          that ultimately the practition-
  output is also fed back andwe show this as a subtraction,      plifyiug the explanation tbat           ers of electronica, professional
  subtracted from the incoming
                             giving 0010. This is between        we use the simplest possible            and amateur, will be drawn
  signal to compensate for the
                             0000 and 0011, so the output        kind of low-pass filter--see            increasingly toward The Disi-
                             is '0'. Subtracting thia (=OOOO)
 loss of the remainder. Thehey                                   Fig.87, each 'l' pulse places a         tal Solution.
 to the action of the circuit is
                             from 0010 leaves +0010,             unit charge on the capacitor.                                [940120-XI
 that it operates at four times
                             which becomes the feedback          A continuous series of 'l's
 the sampling frequency, so  for the third cycle. This           rapidly charges the capacitor           A~~~~~ to
 that each input sample is held
                             process is repeated until, at       to the maximum voltage and
 for four cycles. Note that this
                             the end of eight cycles, the        the output signal reaches this          Ted Y O U ~ B (9)
                                                                                                                       (~
 process is entirely digital. The
                             feedback ie zero. The input         level. With a continuous series         1.        Active high.
 output from this circuit mayhaa been completely converted       of '0'8, no charge is supplied to       Q,,       R      S     Qn+l
 then be fed to a DAC with two
                             into a series of Os and 1s with-    the capacitor and the output            L         L     L     i
 fewer bits, and hence greater
                             out any remainder.                  rapidly falls to zero. In the in-       L         L     B     H
 precision than would other-     In the above example, the       termediate situations in                L         B     L     L
wise be required.            input value is decimal 5, and       which between one and seven                       L     L     R
     A similar principle may be
                             the output has five 'l' bits in     pulses are produced for each                      L     A     B
 used to build a l-bit DAC asit out of eight bits. Thus, the     sample, the capacitor is                A         A     L     L
                             output is 518 of the possible
shown in Fig. 86. In this, the                                   charged to a greater or lesser
 quantizer' has only hlevels maximum of 8. The reader            degree and an intermediate              2
 of output, '0' and 'l', and is
                             might try this routine for          output voltage is generated             Latch No XOR      Output
 known as a l-bit quantizer. If
                             other inputs to confirm that,       accordingly.                            1 2 3 4 (of 3&4) (4)
 it receives a sample with a for any input between 0000              Bit stream technology is                     fed back
 value up to but not including
                             and 1000, the number of 'l's        one of the newer develop-               0 1 1 0       1       0
 0.5 of the maximum value, its
                             produced in eight cycles al-        meuts of digital electronics            1 0 1 1       0       1
 output is 'W. If the sample haa
                             ways equals the value of the        and bas special applications            0 1 0 1       1       1
 a value of 0.5 or more of the
                             input. This procedure can be        in audio electronic%such as in          1 0 l 0       1       0
 maximum value, its output isextended to any number of           CD players. It has its limita-          1 1 0 1       1       1
'l. As before, the operation is
                             input bits and always the pm-       tions, the primarp one being            1 1 1 0       1       0
repeated several times for   portion of 'l' bits in the output   tbat to convert a 16-bit sam-           1 1 1 1       repeats
each input sample. However,  equals the proportion of the        ple requires a bit stream DAC
in this case, we do not feed iuput value to the maximum          cycling a t about 3 GHz. This           Sa 4095
back the output signal, but  value.                              is not easy to achieve in the
the difference between the       The output of a DAC such        present state of circuit fabri-         3b 16777215
output signal and the sample,as this is a stream of 'l' bits     cation, so hybrid techniques
                             (high logic level) interspersed
so as to allow for the loss of                                   are used, such as reduciug the
information stored in the dis-
                             with '0' bits (low logic level)     number of bits by using cir-
carded bits. To see how this and is known as a bit stream.       cuits such as that in Fig. 85
works and the nature of its  The bit stream is produced          and completing the process
                             wholly by digital circuits,         with conventional DACs, or
                             which means that there are          combining bit stream tech-
'to quantlze = to digitize = no problems with precision,         niques with interpolation.
to convert an analogue sig- ageing of components, noise,
nal to a digital slgnal.     or any of the other snags that
ELEKTOB ELECTRONICS OCFOBER 1995