# PWM-Based Analog Calculator Provides Four-Quadrant Multiplication, Division

Jan. 15, 2013
You can build an analog calculator using a pulse-width modulator (PWM) to perform accurate four-quadrant multiplication and division. While this approach won’t help you ace any math tests, it demonstrates some useful sub-circuits that extend the functionality of the LTC6992 TimerBloxvoltage-controlled PWM.
This file type includes high resolution graphics and schematics.

You can build an analog calculator using a pulse-width modulator (PWM) to perform accurate four-quadrant multiplication and division. While this approach won’t help you ace any math tests, it demonstrates some useful sub-circuits that extend the functionality of the LTC6992 TimerBloxvoltage-controlled PWM.

The LTC6992-1 translates a 0-1 V input at the MOD pin into an output with a 0% to 100% duty cycle at a frequency of 3.81 Hz to 1 MHz. A resistor at the SET pin and a resistor divider at the DIV pin control this frequency. In some applications, the LTC6992 will be in the feed-forward path of a closed-loop control system (as in a motor-speed controller), so its 1% typical linearity provides consistent overall loop performance.

Figure 1 shows a basic linearized PWM generator for applications where accurate PWM is required without an external feedback mechanism. This circuit easily achieves 0.1% PWM accuracy. The output of the LTC6992 controls one section of a 74HC4053 triple single-pole double-throw (SPDT) analog switch whose output is switched between ground and an LT6654-1.25 reference. An integrator compares this signal to the control input. The output duty cycle will settle on a value that equals the fraction of the 1.25-V reference that’s present at the input. The term “fraction” implies that this circuit performs division, as the output PWM duty cycle is VIn/VRef.

Figure 2 extends this concept, with X as the input (numerator) and Y as the reference (denominator). An LT1991 configured in a gain of –1 provides a precise negative copy of Y, extending operation to four quadrants (positive and negative X and Y), with duty cycle = 50% × [1 + (X/|Y|)].

As with any physical realization of division, a zero value for the denominator (Y) will produce an undefined output. A negative voltage applied to the Y input inverts the polarity of the feedback signal to the integrator, which requires another inversion somewhere in the loop to ensure feedback is negative.

The DIV pin also can invert the PWM polarity (a 0- to 1-V input = 100% to 0% duty-cycle output), in addition to selecting one of eight NDiv values to set the frequency. The NDiv magnitudes are mirrored around VCC/2, where swapping values in the resistor divider inverts the transfer function while maintaining the same divider value (see the table).

An LT1671 comparator detects the polarity of the Y input and sets the polarity by switching the divider potentiometer’s excitation accordingly, maintaining correct operation. Note that a 10-turn potentiometer works well for experimentation. You could replace it with a fixed resistor once you have selected the desired NDiv.

The “Z” input is multiplied by the X/Y quotient by supplying the inputs to another switch with Z and –Z. (Once again, an LT1991 provides precision inversion.) This is a “pulse width/pulse height” multiplier, also with four-quadrant operation.

Figure 3 shows the absolute error of the circuit at a 1.5-kHz frequency, sweeping X from –Y to +Y for values of Y from –3 V to +3 V, while holding Z constant at 5 V. Even with Y at 0.5 V (where error sources are more significant), the worst-case error is about 0.6% and rapidly improves with larger values of Y. Error sources include the 0.04% error of the LT1991, mismatch in switch resistance between its two positions compared with the resistance of the downstream filter's resistance, and the response of the LT1991 outputs to switching transients, whose effect will vary with PWM frequency.

Mark Thoren is the applications engineering manager for mixed-signal products at Linear Technology. He has a BS in agricultural/mechanical engineering and an MS in electrical engineering, both from the University of Maine. He can be reached at [email protected].