Digital to analog converter
BACKGROUND OF THE INVENTION 
     The present invention relates to a digital to analog converter and, more particularly, to a converter and a method of conversion that accomplishes the conversion by duty cycle modulation. 
     In the design of interfaces for digital or microprocessor-based electronic circuits, it is often necessary to convert a binary number to an equivalent voltage or current. This is accomplished by a circuit commonly referred to as a digital to analog (&#34;D/A&#34;) converter which divides a precision reference voltage into a ratio proportional to the binary number. The division is accomplished either by a ladder of precisely ratioed resistors or by duty cycle modulation. The present invention relates to a D/A converter using duty cycle modulation. 
     A circuit for this type of D/A conversion generates a wavetrain having a duty cycle proportional to the binary input and an amplitude equal to the reference voltage (V r ). The duty cycle, D, is the ratio of time &#34;on&#34; to time &#34;off&#34; for one cycle of a wavetrain. A common approach to generating the wavetrain is to load the binary input into a counter. The output of the counter is held high while the counter counts down to zero. When the counter reaches zero, the output is set back to low until it is time for the cycle to be repeated. The cycle time or wavetrain period, T, is equal to the product of the number, 2 n , and the period of a clock cycle, where n is the number of bits comprising the binary number. For example, a wavetrain for a three-bit D/A converter could be in one of eight forms, 2 3 , wherein the pulse width [(&#34;PW&#34;), where PW×(T)(D)] ranges from 1/8 to 7/8 of the wavetrain period, T, and has an amplitude equal to the reference voltage (V r ). Thus, for the binary number 011. The D/A converter provides a wavetrain having a duty cycle corresponding to the binary number, i.e., a duty cycle of D=3/8. The wavetrain is applied to the input of a low pass filter which derives an average value. The average value of the wavetrain is equal to the product of its amplitude, the reference voltage (V r ), and its duty cycle (D), in this case 3/8. 
     The low-pass filter can be, for example, a single-pole RC circuit. The problem with such a filter is that the time constant of the filter must be long relative to the wavetrain period (T) in order to reduce the output ripple to a value smaller than one least significant bit, lsb, i.e., a number equal to 1/2 n , where n is the number of bits comprising the binary number. This requirement seriously limits the speed of response of the D/A converter. Furthermore, a D/A converter for larger binary numbers requires filter components having correspondingly larger values. As a result, the necessary filter components are too large in size for integrated circuit designs. For example, when the time constant of the filter is longer than the wavetrain period (T), the wave shape of the output will be triangular, rising during the high pulse time and falling during the low pulse time. The rising portion of the ripple, R, is defined as follows: 
     
         Equation 1: R=(V.sub.r -V.sub.0) (PW/τ) 
    
     where: 
     
         V.sub.r =reference voltage 
    
     
         V.sub.0 =output voltage 
    
     
         PW=pulse width of the waveform 
    
     
         τ=time constant of the filter 
    
     Since V 0  =(V r ) (D) and PW=(T) (D), the ripple percentage, R% (=R/V r ), becomes: 
     
         Equation 2: R%=(1-D) (D)(T)/τ 
    
     Since the function (1-D) (D) has a maximum value of 0.25 when D is equal to 0.5 (i.e., a 50% duty cycle), the maximum ripple percentage, R% max, is equal to 0.25(T)/τ. As mentioned above, R% max must be less than one lsb or 1/2 n . Substituting this value for R% max, the time constant of the filter can be defined as follows: 
     
         Equation 3: τ=0.25(T)2.sup.n 
    
     Assuming that the frequency, f, is equal to 2 MHz, the filter&#39;s time constant for a 3-bit digital number would be equal to 3 ms, which is an acceptable design value. However, the filter&#39;s time constant for a 14-bit word would be greater than 33 seconds, which is not acceptable. 
     Accordingly, there is a need for a D/A converter using duty cycle modulation and, more specifically, one that is capable of converting a large binary number to an analog signal while still using reasonably sized filter components that can be used in conjunction with the design of integrated circuits. 
     SUMMARY OF THE INVENTION 
     The present invention meets these needs by providing a circuit and method for converting a binary number having a plurality of bits, D 0  to D n , to a signal having aproportionally equivalent characteristic. 
     The circuit comprises a parallel input for receiving each bit, D 0  to D n , of the binary number and means for generating wavetrains, W 0  to W n , having frequencies decreasing by powers of two from the least significant wavetrain, W 0 , to the most significant wavetrain, W n . Each wavetrain comprises pulses having a pulse width equal to the inverse of twice the frequency of the least significant wavetrain, W 0 , so that the duty cycle of each of the wavetrains is proportional to the corresponding frequency thereof. The pulses of each of the wavetrains are nonoverlapping with the pulses of the other wavetrains. The circuit also codmprises logic means, connected to the input and the generating means, for logically multiplying each wavetrain taken in an order from the least significant to the most significant, W 0  to W n , by a corresponding bit of the binary number taken in a reverse order from the most significant to the least significant, D n  to D 0 , and logically summing all of the products of each, the sum thereof being a composite waveform. The circuit also comprises output means, connected to the logic means, for receiving the composite waveform. Thus, the composite waveform has a duty cycle proportionally equivalent to the binary number. 
     The output means may further comprises means for smoothing the composite waveform to provide an analog signal equivalent to the duty cycle of the composite waveform, whereby the analog signal is proportionally equivalent to the binary number. The output means may further comprise referencing means for referencing the composite waveform by setting a logic one level of the composite waveform to a precise reference voltage and a logic zero level of the composite waveform to a ground level, whereby the referencing means provides the composite waveform to the smoothing means. 
     The method comprises the steps of receiving each bit, D 0  to D n , of the binary number and providing downcounting signals, N 0  to N n , each comprising a series of pulses where in the frequencies decrease by powers of two from the least significant downcounting signal, N 0 , to the most significant downcounting signal, N n . The method further comprises the step of inverting each downcounting signal, N 0  to N n , and logically multiplying each inverted downcounting signal by all of the corresponding less significant downcounting signals, the products thereof forming wavetrains, W 0  to W n , each wavetrain having pulses of the same width and not overlapping with the pulses of the other wavetrains and having frequencies decreasing by powers of two from the least significant wavetrain, W 0 , to the most significant wavetrain, W n . The method further comprises the step of logically multipling each wavetrain taken in an order from the least significant to the most signicant, W 0  to W n , by a corresponding bit of the binary number taken in a reverse order from the most significant to the least significant, D n  to D 0 , and logically summing all the products of each, the sum thereof being a composite waveform. The composite waveform consists of each wavetrain enabled by the corresponding bit thereof and having a peak amplitude equal to that of the pulses of the wavetrains and a duty cycle proportionally equivalent to the binary number. 
     The method may further comprise the step of smoothing the composite waveform to provide an analog signal being proportionally equivalent to the binary number and equal to the product of the amplitude and the duty cycle of the composite waveform. 
     Accordingly, it is an object of the present invention to provide a circuit and method for converting a binary number having any number of bits to a signal having a proportionally equivalent characteristic; to provide a D/A converter and method for D/A conversion using such circuit; to provide an analog signal having a proportionally equivalent voltage or current; and to provide such a D/A converter and a method for D/A conversion that is capable of converting a large binary number to an analog signal while still using reasonably sized filter components that can be used in conjunction with the design of integrated circuits. 
     Other objects and advantages of the invention will be apparent from the following description, the accompanying drawings, and the appended claims. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an electrical schematic of the D/A converter which comprises a wavetrain generator and a sum of the products (SP) circuit constructed in accordance with the invention. 
     FIG. 2 is an electrical schematic of the wavetrain generator shown as a block diagram in FIG. 1. 
     FIG. 3 is an electrical schematic of the SP circuit shown as a block in FIG. 1. 
     FIG. 4 is a series of time graphs illustrating the relative timing sequence of signals existing within the wavetrain generator and the SP circuit of FIG. 1 to generate a composite waveform signal (CW) in accordance with the invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Referring to FIG. 1, a D/A converter is indicated generally at 10 for converting a binary number at its input along a parallel bus 12 to an analog signal at its output along a wire 14 having an output voltage, V 0 , proportionally equivalent to the binary number. The D/A converter 10 further comprises a latch 16 having parallel inputs connected to the parallel bus 12 for receiving the binary number and a load terminal LD connected to a data clock. When the data clock causes the load terminal LD to go high, the latch 16 transmits the binary number to its parallel outputs connected to the parallel data bus 18. Each binary data signal or bit, D.sub. to D 13  of the binary number is held at the output of the latch 16 when the load terminal LD goes low. 
     The D/A converter 10 further comprises a wavetrain generator 20 which consists of a down counter 22, providing 14 downcounting signals, N 0  to N 13 , along a parallel bus 24 and a decoder 26 providing 14 wavetrains, W 0  to W 13 , along a parallel bus 28. The D/A converter 10 further comprises a sum of products, SP, circuit 30 which is connected to the parallel buses 18, 28 for receiving the binary data signals, D 0  to D 13 , and the wavetrains, W 0  to W 13 , and for providing a composite waveform, CW, at its output along a wire 32. The down counter 22 provides a timing signal, TS, at its output along a wire 34. The D/A converter 10 further comprises a D-type flip flop 36, a precision reference voltage source 38 and a low-pass filter 40. The D-terminal of the flip flop 36 is connected to the wire 32 for receiving the composite waveform (CW) and the toggle terminal of the flip flop 36 is connected to the wire 34 for receiving the timing signal (TS). The Q-output of the flip flop 36 is connected by a wire 42 to the precision reference voltage source 38 having an output connected via a wire 44 to the low-pass filter 40. The output of the low pass flter 40 provides the analog signal along the wire 14. 
     Referring to FIG. 2, the wavetrain generator 20 comprises the downcounter 22 and the decoder 26 as described above. The downcounter 22 has fourteen output terminals, 0 to 13, which provide the downcounting signals, N 0  to N 13 , to the decoder 26 and are connected to the decoder 26 as follows. Output terminal O is connected to the input of an inverter 50 and the first inputs of three NAND gates 51, 52, 53, the outputs of which are connected respectively to the first inputs of four NOR gates 54, 55, 56, 57. The output of the inverter 50 provides the wavetrain W 0  and the outputs of the NOR gates 54, 55, 56, 57 respectively provide the four wavetrains W 1  to W 4 . Output terminal 1 of the downcounter 22 is connected to the second inputs of the NOR gate 54 and the NAND gates 51, 52, 53; output terminal 2 is connected to the second inputs of the NOR gate 55 and third inputs of the NAND gates 52, 53; and, output terminal 3 is connected to the second input of the NOR gate 56 and a fourth input of the NAND gate 53. The output of the NAND gate 53 is also connected to the first input of an OR gate 58. 
     Output terminal 4 of the downcounter 22 is connected to the input of an inverter 60 and the first inputs of three NAND gates 61, 62, 63, the outputs of which are connected respectively to the first inputs of four NOR gates 64, 65, 66, 67. Output terminal 4 is also connected to the second input of the NOR gate 57. The outputs of the NOR gates 64, 65, 66, 67 respectively provide the four wavetrains, W 5  to W 8 . Output terminal 5 of the downcounter 22 is connected to the second input of the NOR gate 64 and the NAND gates 61, 62, 63; output terminal 6 is connected to the second input of the NOR gate 65 and third inputs of the NAND gates 62, 63; and, output terminal 7 is connected to the second input of the NOR gate 66 and a fourth input of the NAND gate 63. 
     Output terminal 8 of the downcounter 22 is connected to the input of an inverter 70 and the first inputs of three NAND gates 71, 72, 73, the outputs of which are connected respectively to the first inputs of four NOR gates 74, 75, 76, 77. Output terminal 8 is also connected to the second input of the NOR gate 67. The outputs of the NOR gates 74, 75, 76, 77 respectively provide the four wavetrains, W 9  to W 12 . Output terminal 9 of the downcounter 22 is connected to the second input of the NOR gate 74 and the NAND gates 71, 72, 73; output terminal 10 is connected to the second input of the NOR gate 75 and third inputs of the NAND gates 72, 73; and, output terminal 11 is connected to the second input of the NOR gate 76 and a fourth input of the NAND gate 73. 
     Output terminal 12 is connected to the second input of the NOR gate 77 and the input of an inverter 78, the output of which is connected to the first input of a NOR gate 79. Finally, output terminal 13 of the downcounter 22 is connected to the second input of the NOR gate 79, the output of which provides the wavetrain W 13 . The output of the NAND gate 53 is also connected to third inputs of the NOR gates 64, 65, 66, 67, 74, 75, 76, 77. The output of the NAND gate 63 is also connected to fourth inputs of the NOR gates 74, 75, 76, 77 and the second input of the OR gate 58 having a third input connected to the output of the NAND gate 73. The output of the OR gate 58 is connected to a third input of the NOR gate 79. 
     Essentially, the decoder 26 derives each wavetrain, W 0  to W n , by logically multiplying each of the corresponding negagated downcounting signals, N 0  to N 13 , from the counter 22 and all of the lower order output signals from the counter 22. Thus, each wavetrain is defined by the following logic formulas: ##EQU1## 
     Referring also to FIG. 4, the wavetrain clock signal, the first four least significant downcounting signals, N 0  to N 3 , and the first four least significant wavetrains, W 0  to W 3 , are shown in the time domain over a period from t 0  to t 16  as an example. All of the following discussion applies equally to all the higher order wavetrains from W 4  to W 13  to W n . The corresponding truth table for this logic circuit is as follows (certain logic zero being indicated by a blank space for illustration): 
     
                       TABLE A                                                     
______________________________________                                    
Time N.sub.3                                                              
            N.sub.2                                                       
                   N.sub.1                                                
                        N.sub.0                                           
                             W.sub.3                                      
                                   W.sub.2                                
                                         W.sub.1                          
                                               W.sub.0                    
______________________________________                                    
t.sub.15                                                                  
     0      0      0    0                      1                          
t.sub.14                                                                  
     0      0      0    1                1     0                          
t.sub.13                                                                  
     0      0      1    0                      1                          
t.sub.12                                                                  
     0      0      1    1          1     0     0                          
t.sub.11                                                                  
     0      1      0    0                      1                          
t.sub.10                                                                  
     0      1      0    1                1     0                          
t.sub.9                                                                   
     0      1      1    0                      1                          
t.sub.8                                                                   
     0      1      1    1    1--   0--   0--   0                          
t.sub.7                                                                   
     1      0      0    0                      1                          
t.sub.6                                                                   
     1      0      0    1                1--   0                          
t.sub.5                                                                   
     1      0      1    0                      1                          
t.sub.4                                                                   
     1      0      1    1          1--   0--   0                          
t.sub.3                                                                   
     1      1      0    0                      1                          
t.sub.2                                                                   
     1      1      0    1                1--   0                          
t.sub.1                                                                   
     1      1      1    0                      1                          
t.sub.0                                                                   
     1      1      1    1                      0                          
______________________________________                                    
 
    
     As can be seen in FIG. 4, the frequencies of the wavetrains, W 0  to W 3 , decrease by powers of 2 from the least significant wavetrain, W 0 , to the most significant wavetrain, W 3 . Assuming that the frequency of the wavetrain clock is equal to 2 MHz, the frequencies of the wavetrains, W 0  to W 3 , would be respectively 1.0, 0.5, 0.25 and 0.125 MHz; the frequency for the most significant wavetrain W 13  would be equal to about 122 Hz. Additionally, the pulse-width (PW) of each wavetrain is equal to the inverse of twice the frequency of the least significant wavetrain, W 0 . This results because each wavetrain is derived by ANDing the corresponding negated output signal from the counter 22 and with all of the lower order output signals. This is illustrated by the shading in FIG. 4 for the wavetrain W 3  at time t 8  and by the corresponding dashed lines at time t 8  in the truth table, Table A. 
     Assuming again that the wavetrain clock frequency is equal to 2 MHz, the pulse width (PW) for the pulses of all the wavetrains, W 0  to W n , is equal to 500 nanoseconds. Since the wavetrains comprise pulses having the same width, the duty cycle (D) of each wavetrain is proportional to its frequency. Therefore, the duty cycle (D) of the wavetrains, W 0  to W 3 , would be respectively 1/2, 1/4, 1/8and 1/16; the duty cycle (D) for the most significant wavetrain (W 13 ) would be equal to 1/16384, i.e. 1/2 n , where n=14. 
     The wavetrains are also nonoverlapping, i.e., the pulses of one wavetrain do not overlap the pulses of any other wavetrain in time as shown by the shading in FIG. 4 for the wavetrains, W 1  and W 2 , at times t 2 , t 4  and t 6  and by the corresponding dahsed lines at the same times in the truth table, Table A. The wavetrains are nonoverlapping because a downcounter causes only one bit to go to 0 at a time as shown in the truth table, Table A. The nonoverlapping feature is important because any combination of the wavetrains can be logically ORed to produce an equivalent composite duty cycle for the binary number being converted. 
     Referring to FIG. 3, the wavetrains, W 0  to W 13 , are provided to the SP circuit 30 by the parallel bus 28 which provides each wavetrain via a separate wire to the first inputs, respectively, of fourteen NAND gates 100 to 113. The binary bits, D 13  to D 0 , of the binary number are also provided to SP circuit by the parallel bus 18 which provides each bit via a separate wire to the second inputs, respectively, of the NAND gates 100 to 113. The outputs of the NAND gates 100 to 103 are connected to the inputs of an AND gate 121; the outputs of the NAND gates 104 to 107 are connected to the inputs of an AND gate 122, the outputs of the NAND gates 108 to 111 are connected to the inputs of an AND gate 123; and, the outputs of the NAND gates 112 and 113 are connected to the inputs of an AND gate 124. The outputs of the AND gates 121 to 124 are connected to the inputs of an AND gate 125, the output of which provides the composite waveform signal (CW) on the wire 32 which has a duty cycle (D) proportional to the binary number. 
     Essentially, the SP circuit 30 is a sum-of-products circuit. When viewing the operation of the gates 100 to 113 as AND gates, they form the logical products, W 0  D 13  to W 13  D 0 . Associating the inversion of the NAND gates, 100 to 113, with the inputs of the AND gates, 121 to 124, transforms them into NOR gates which function as OR gates when their inverted outputs are applied to the AND gate 125. Thus, the products, W 0  D 13  to W 13  D 0 , are logically ORed or summed by gates 121 to 125 to form the logical expression for the composite waveform (CW) as follows: 
     
         CW=W.sub.0 D.sub.13 +W.sub.1 D.sub.12 + . . . +W.sub.13 D.sub.0 
    
     Each wavetrain, W 0  to W 13 , is ANDed with the corresponding binary bit, D 13  to D 0 , and the resulting products are ORed together. 
     The wavetrains to be included in the composite waveform (CW) are selected by the corresponding binary bits, i.e., a positive pulse enables the transmission of the corresponding wavetrain. The enabled wavetrains are logically summed to form the composite waveform (CW) which has a duty cycle (D) proportional to the binary word. For example, if the D/A converter 10 is designed to convert a three-bit binary number, the composite waveform (CW) is defined as follows: 
     
         CW=W.sub.0 D.sub.2 +W.sub.1 D.sub.1 +W.sub.2 D.sub.0 
    
     Referring to this logical equation and the wavetrains W 0 , W 1  and W 2  in FIG. 4, the duty cycle (D) corresponding to each binary number can be determined as shown in the following truth table: 
     
                       TABLE B                                                     
______________________________________                                    
W =    W.sub.0 W.sub.1                                                    
                      W.sub.2                                             
D =    D.sub.2 D.sub.1                                                    
                      D.sub.0                                             
                             CW         D                                 
______________________________________                                    
0          0      1        W.sub.2    1/8                                 
0          1      0        W.sub.1    2/8                                 
0          1      1        W.sub.1 + W.sub.2                              
                                      3/8                                 
1          0      0        W.sub.0    4/8                                 
1          0      1        W.sub.0 + W.sub.2                              
                                      5/8                                 
1          1      0        W.sub.0 + W.sub.1                              
                                      6/8                                 
1          1      1        W.sub.0 + W.sub.1 + W.sub.2                    
                                      7/8                                 
______________________________________                                    
 
    
     As can be seen in both Table B and FIG. 4, the duty cycle (D) increases in direct proportion to the binary number being converted because the wavetrain having the highest frequency W 0 , is selected if the most significant bit, D 2 , is set, the wavetrain having the second highest frequency, W 1 , is selected if the second most significant bit, D 1 , is set, and the wavetrain having the third highest frequency, W 2 , is selected if the third most significant bit, D 0 , is set. The same explanation applies to a D/A converter for converting a 14-bit word where the duty cycle (D) of the composite waveform (CW) will vary by increments of 1/16,384 (1/2 n ). 
     The composite wave form (CW) is then clocked by the timing signal (TS), in this case 2 MHz, through the flip flop 36 to synchronize precisely the edges to the wavetrain clock, thus eliminating the effects of varying propagation delays. The output from the flip flop 36 is provided via the wire 42 to the precision reference voltage source 38 which comprises a discrete CMOS transistor package including an NMOS FET and a PMOS FET. A positive reference voltage, V r , is applied to the drain terminal of the PMOS FET and the source of the NMOS FET is grounded. The wire 42 is connected to the gate terminals of both FETS. The source terminal of the PMOS FET and the drain terminal of the NMOS FET are connected and provide an output signal via the wire 44 to the low-pass filter 40. The CMOS transistor package insures that the logic one and zero levels are accurately set to the reference voltage (V r ) and to the analog ground level. The low-pass filter 40 is a single-pole RC filter comprising a resistor 39 having one end connected to the wire 44 and a capacitor 41 connected between the other end of the resistor 39 and ground. the low-pass filter 40 integrates the composite waveform output signal provided via the wire 44 to obtain the average DC value which is the analog output signal provided via the wire 14 across the capacitor 41. The analog signal is equal to the product of the reference voltage (V r ) and the duty cycle (D) of the composite waveform (CS), and is therefore proportional to the binary number being converted. 
     The D/A converter 10 just described drastically reduces the requirement of earlier devices for filters having time constants that were too large for practical design in order to insure that the ripple percentage (R%) is less than one least significant bit. The ripple at the output of the filter 40 is determined by adding the individual ripple due to each wavetrain comprising the composite waveform (CW). Therefore, Equation 2 must be solved for each composite wavetrain. 
     As previously defined, the time period (T) is equal to 2 n  wavetrain clock cycles. For the D/A converter 10, it is also the time period of the wavetrain, W 13 , having the lowest frequency that is associated with the least significant bit, D 0 , of the binary number. Therefore, the period, T n , of all the other wavetrains, W 0  to W 12 , is equal to T/2 where b is the bit number ranging from 0 to the number, n-1 or 12, for the most significant bit. The duty cycle, D n , also varies for each component wavetrain and is equal to 2 b  /2 n . When T n  and D n  are substituted into Equation 2, the ripple percentage is defined as follows: 
     
         Equation 4: R%=(1-2.sup.b /2.sup.n) (1/2.sup.n) (T/τ) 
    
     For the most significant bit, D 13 , the duty cycle of the corresponding wavetrain, W 0 , is 0.5, which makes the ripple percentage (R%) half that of the lower significant bits, D 0  to D 12  (2 b  /2 n  approaches 0.5). The maximum ripple percentage (R% max) is for the least significant bit, D 0 , where the duty cycle is nearly 1.0 (2 b  /2 n  approaches 0). Therefore, if all the composite wavetrain components, W 0  to W 13 , are selected and were in phase, the maximum ripple percentage (R% max) is equal to n times the ripple percentage of the least significant bit or n(1/2 n ) (T/τ). Hence, if the ripple percentage is to be less than one least significant bit, 1/2 n , and substituting into the immediately preceding equation, then the time constant for the RC filter 40 is defined as: 
     
         Equation 5: τ=2T=2(2.sup.n /f)=2.sup.n+1 /f 
    
     Thus, for a 14-bit D/A converter having a wavetrain clock operating at 2 MHz, the time constant must be no smaller than 16 ms which is substantially smaller than the 33 seconds required by previous D/A converters. In the specific embodiment of the present invention, the resistor 39 has a value of 200 K ohms and the capacitor 41 has a value of 0.01 microfarads which provides a time constant of 20 ms that satisfies the above requirement. Filter components having these values are much less expensive and very much smaller than what would be required for previous D/A converters. 
     Having described the invention in detail and by reference to preferred embodiments thereof, it will be apparent that other modifications and variations are possible without departing from the scope of the invention defined in the appended claims.