| ANALOG AN-322 DEVICES APPLICATION NOTE ONE TECHNOLOGY WAY e P.O. BOX 9106 e NORWOOD, MASSACHUSETTS 02062-9106 @ 617/329-4700 improve Function Generators with Matched D/A Converters by Paul Toomey With a pair of precisely matched 8-bit CMOS DACs in one IC, you can create inexpensive circuits that digitally control high-precision analog waveforms. Using the AD7528, a low-cost IC containing two 8-bit CMOS multiplying DACs, you can design a variety of signal-generation circuits for audio, computer-graphics Ao~ As ADDRESS oo) and process-control applications. These designs, which If require a pair of closely matched, tightly tracking D/A i converters, have heretofore proved impractical to ADDRESS: DAC, /DAC, produce because the selection and testing necessary to Vua DECODE ws lo Aca match the DACs has made them quite expensive. e200 ee Three useful circuitsa programmable sine-wave cPu AD7528 oscillator, a function-fitting sine-wave synthesizer and T >| we [oc > a triangle/rectangle-wave generatorclearly demon- * strate the 7528s design potential. Each circuit is DB, digitally controlled; therefore, before considering the D8, specific designs, you should examine interfaces for widely used microprocessors. To that end, note that the AD7528s two on-chip 8-bit Por paras latches and control inputs (CS, WR and DAC Select) eee oe ADS DAG. On LARITY are logic-level and speed compatible with most pPs. ro) A+ 1= DECODED 7528 ADDR DACs Data-hold time, often a problem in applications using members of the 6800 family, equals zero. Fig 1a shows an interface to a 6800-based system, while Fig 1b Mews TBDRESS BUS) details the connections for an 8085-based system. <3 ae Use dual DACs as ganged potentiometers DOnESS BACAIDACe With this background information, turn to the dual Loaic & | vac, > DACs applications. You can control the frequency of oru A+t AD7528 many oscillator circuits by using two ganged potentiom- | eters, provided that the pots track precisely over their Wa e{i | Ace > full resistance range. Fig 2's high-performance sine- DB, wave oscillator is a state-variable filter design in which ALE] 08 an AD7528 acts as a pair of digitally controlled matched : resistors to replace the ganged potentiometer. The 4T equivalent resistance of each DAC, as seen by op amps AD, AD, TDDRDATAS) As and As, varies from infinity at input code 00x toa 3088 INSTRUCTION SHLD (STORE H&L DIRECT) CAN UPDATE minimum of 10 kf (the DAC ladder resistance) at FF x. BOTH DACs WITH DATA FROM H AND L REGISTERS Because the same code is loaded into each DAC, the expreasion for the output frequency (in hertz) becomes Fig 1Minima! intertace logic is required when you f=N/256(21RC), where N is the DAC code (base 10), R combine the AD7528 dual DAC with widely used Ps such as the 6800 (a) and 8085 (b) because the chip comune 10 Reprinted from EDN May 12, 1982 DIGITAL-TO-ANALOG CONVERTERS 8-161Summing resistors are critical to function fitters performance a the DAC ladder resistance and C is the feedback pacitance for A, and As. For the circuit values shown in Fig 2, output frequency varies from 0 to 15 kHz in steps of approximately 60 Hz, with an amplitude of about 20V p-p. Total harmonic distortion measures 53 dB at 1 kHz and 43 dB at 14 kHz. Combine multiplication and function fitting Function fitting translates a mathematical or empiri- cal relationship from one medium (such as a mathemati- cal formula) to another (usually a physically realizable | device or system). By taking advantage of the multiply- ing capabilities of the AD7528s two CMOS DACs, you can use this technique to synthesize extremely low- frequency, highly stable sine waves. For example, in Fig 3as design, the IC implements a 1-quadrant sin X approximation in the form of the quadratic polynomial Y=1.828N0.828N?, where 0SN=<1 and N=(2/n)X. (See Appendix for the derivation of this equation.) By ramping N up and down and strategically switching the identical twins The AD7528 contains two 8-bit CMOS multiplying current-output D/A converters, each with its own 8-bit latch. Because both DACs are fabricated at the same time on the same chip, they have virtually the sarne R/2R-ladder character- istics, and these characteristics track extremely closely as the supply voltage varies and the ambient temperature changes. Data inputs to the AD7528's on-chip latches share a common input data bus; you contro! the data flow with the DAC,/DAC, latch-setect input. Each section of the IC provides its own analog reference and feedback inputs, so you can operate the DACs inde- pendently. Channel-to-channel isolation typically measures 77 dB at 100 kHz. Settling time varies with supply voltage. After a digital input change, the analog output settles to within 90% of its final value in 80 nsec with a 15V supply; with a 5V supply, settling occurs in 270 nsec. Regardiess of the supply voltage, though, the AD7528 typi- cally draws just 1 mA. For more information on the AD7528, Circle No 750. Vv Voo 9 Vaer, (5-15V) 4 ) RFB, b17 DB, M4 oe ; 24s our, DATA INPUT LATCH DAG, INPUTS 0B, Tt) BUFFER A , 1 AGND A07528 6 DAC, /DAC, O- > 19 AFB, 15 . JCONTROL! y GS o- 1 Logic fT. 0 16 OUT, Wh o > | LATCH DAC, 5 18 DGND Simultaneous fabrication of the AD7528's two CMOS mutiplying DACs yields virtually identical R/2R-ladder characteristics. O Vor, 8-162 DIGITAL-TO-ANALOG CONVERTERS8-BIT FREQUENCY. SELECT CODE & 10k AAp vVVV OUT, Ye AD7528 c il At Tt tc 1000 pF x Zz 1000 pF PN OUT, Aa Vege, Ay I$ Vout ra DAC, AGNOD, + *adess 1 AD7528 2 ADGAS -based programmable sine-wave oscillator. NOTE: DAC CONTROL LINES OMITTED FOR CLARITY Fig 2DAC, and DAC, act as matched, digitally controtied resistors, replacing a ganged precision potentiometer, in this state-variable-fitter. : Ok output polarity, the circuit generates sin X in four stages (Fig 3b). Specifically, an input square-wave clock drives a counter that counts up and down continuously, provid- ing a Borrow output pulse every time it reaches the all-ZEROs count. In turn, DAC, produces a triangle wave consisting of two ramps of opposite slope, each generated in 256 steps of op amp A,s output. This is the analog N variable. To produce the analog N? variable, DACs multiplies Ns digital version by its analog version. Op amp A; inverts the product signal, producing N*. Then amplifier Ay sums the two variables in the correct 1.828 and 0.828 weighting, as determined by R, and Rs, to produce the Y signal. A smooth sine wave results when op amp A, switches the circuit's output polarity to generate properly timed positive and negative signals. Distortion in the output sine wave is a function of the quadratic-approximation fit to the sine curve. There- fore, the values of Ra and Rg are critical to proper circuit operation. Measured distortion for Fig 3s circuit values is 35 dB; it remains constant over the 0 to 2500-Hz range, as does the output amplitude. If you want to sweep the circuits output frequency, you can do so rapidly by varying the input clock rate. The counters Borrow output provides a valuable zero-crossing pulse in such use. Additionally, by applying an ac signal to DAC,s reference input, you can amplitude-modulate the output sine wave. Generating triangles and rectangular pulses Certain applications require triangular or rectangu- lar waveforms in which you can program the period of each half cycle. For example, the former serve as sweep signals in vector-scan CRT displays to generate variable-length vectors. The design depicted in Fig 4 serves such requirements extremely well. In operation, DAC, defines the ramp rate for the triangles positive slope; DACs, the rate for the negative slope. Comparators A, and A; sense the integrators output, driving gates G, and G, when the level reaches +10 or 10V. These gates act as an RS DIGITAL-TO-ANALOG CONVERTERS 8-1635V 5 ? 10 9 116 10 fe 16 wo BD Vip wo BO Voo ce cpsoze oe Sig coseze re} = 18 [PICLK PICLK Q, Q, Q, Q, PE_GND | Q; GQ; Q; Q PE GN fl | *] a T J Ti] 14) 2] 1 LB aes F + OsVv wcD4013 Lo 14 Veo 5 Dd 1 | %cD4001 2 CLK 2 "of F g 2 SET RES el 4 = : %4CD4013 1 D af 11 CLK = set__Op2 ND RES 7 @) 256 COUNTS 10 A 0 A, OUTPUT =x VARIABLE B 0 - 10V Y y , Ag OUTPUT = x? 0 eR *___ -10V Ay OUTPUT = FULL-WAVE-RECTIFIED SINE 10V ouTPuT oS 0 NL A, OUTPUT = COMPLETED SINE WAVE Fig 3The multiplying capability of the AD7528 gets used to advantage in this function-fitting sine-wave generator (a). The digital representation of N is DACs's input word, while the aneiog representation of N drives the DACs analog reference input. As a result, DACs outputs an anelog signal equal to N*. Resistors R, and Rig relate to the quadratic polynomial that approximates the 1-quadrant sin X function; they must be stable and accurate to achieve minimum distortion (b). 8-164 DIGITAL-TO-ANALOG CONVERTERS0 (o-10v) AFB, our, REF, Ra 10k 20k R AFBs t ws rer Four * Fou. 12.7k As 1 10k OUTPUT OUT + rc - AGND > 1 NOTES: - Ay Ag, As, A, = AD644 ANALOG SWITCH = AD7512 OR AD7592 14 - @ THD=-43dB 12 Wee 10 & OUTPUT FREQUENCY (KHz) NOTES: C = 1000 pF A, ~ Ay = ADS42 1 LSB =60 Hz 4 1 i iL i. 4 4. 4 4. L 4 L 1 L 0 10 2 30 4 S60 60 70 80 9 Ay By Cy Dy Ey Fa FF ) CONTROL WORD DIGITAL-TO-ANALOG CONVERTERS &-165"p flop to select the output of the appropriate DAC via _falog switches SW, and SW:. The arrangement shown lets you use high-speed switches, such as types CD4016 or AD7592, without introducing significant glitches at the DAC changeover. Furthermore, you can update one DAC from the data bus and allow it to settle while using the second DAC to generate the ramp signal. The flip-flop output automat- ically connects the unused DAC to the data bus for further data updating if necessary. You can also use the output to drive the interrupts of a pP. Calculate the period of the waveforms generated by this circuit from the expression T=612RC((1/Na)+(1/Np)), where N, and Np are the DAC, and DACsz codes (1 to 256), respectively. If the latches for both DACs contain the same code, the expression for T is simplified: T=1024RC/N or f=N/1024RC (in hertz). The mark-to-space ratio of the rectangular wave equals No/Na. Note one caution regarding Fig 4s circuit. If the code in either DAC becomes all ZEROs, the integrator input voltage becomes zero, and the circuit stops oscillating. * this condition can occur in your application, connect a MO resistor from each DACs Vrer terminal to its output terminal. This provision produces sufficient bias current to keep the circuit oscillating, yet it doesnt significantly affect frequency calculations, adding only ,-LSB error into each DAC output. Appendix The expression to approximate sin X (0=X=71/2) has the form Y=AX+BX, where A and B are constants. You can evaluate these constants as follows: Replace X (0=X<7/2) with N (0SN=1), where N=(digital code)/256. Next, substitute values for Y and N at two points along the sine curve: (a) X=7/2, ie, N=1: sin(n/2)=1 (b) X=7/4, ie, N=0.5: sin(n/4)=0.7071. This substitution produces two equations: 1=A(1)+B(1? 0.7071=A(%2)+ B(2)*. Solving these equations simultaneously for A and B yields A=1.828 and B=0.828. Thus, the corresponding values for R, and Re in Fig 3a are R,a=5.5 kQ and Rs=12.7 kQ for unity gain. [ j RFB, i 5V Vaer, \ OUT, 1ov oO+ Ry $ 1k DAC, Ay damm 10V > + a ADGAT As | sw, A311 pata | 08> AGNDS INPUT of) ADTE28 ra tS o> Be gev 2 WRo>9 OUT. PN We gtk DAC, Aa aN A -10V one ae LO Manes roan DGND DAG,/DACh, = | F ~0 RECTANGLE TO uP INTERRUPT _ iFREQUIRED ~+ <= - . NOTE: SW,, SW, = AD7512, AD7592 waveform Fig 4You can update one DAC and allow it to settle while using the second DAC to generate a remp in this programmable generator. Oscillation stops if either DAC has an all-ZEROs input code, however. if this is a problem in your application, connect a 10-MQ) resistor between each DAC's Veer and output terminals. 8-166 DIGITAL-TO-ANALOG CONVERTERS