A simple timer can set a pin HIGH for N clock cycles out of 1024, then LOW for
1024 - N clock cycles. That output pin, with some RC filtering, generates about the same range and precision of voltages as a 10-bit DAC. But, cheaper.It also has ripple, because the filtered output ramps UP while the pin is high, and DOWN while low, dithering around the intended value, in addition to slowly (exponentially) decaying to a new average output value when a change is made.
The RC time constant ought not to be made too long, or a change won't propogate quickly, but cannot be made too short, or the ripple will grow to be more than an LSB of the output.
If one were, however, to use an analog switch in a sample/hold amplifier, taking a sample at N/2 cycles and/or at N + (1024-N)/2, the hold value would both ramp as quickly as the RC time (give or take half the PWM cycle period), AND would be devoid of the triangle-wave-like ripple.
So, the idea is to change from one PWM output, to a PWM output and a two-pulse strobe auxiliary output. Then an external S/H amp can buffer the PWM aerage value, while rejecting the PWM ripple (because the strobe selects the centerpoints of rise and fall phases).
Does a cheap (?quad) S/H chip exist to support this? Have any of the usual controller chips ever had an output option like this?