On Sat, 30 Dec 2000, Robert A. LaBudde wrote: > At 05:39 PM 12/30/00 -0600, Scott wrote: > > >Perhaps (but I didn't see it). The PWM resolution is ultimately related to the > >clock. If you have an algorithm that can produce changes for any arbitrary > >clock > >edge then you're not going to get any better than that. Here's a software PWM > >that has single instruction cycle resolution: > > > >http://www.dattalo.com/technical/software/pic256.txt > > People seem to have difficulty understanding this scheme, which is > essentially trading high-frequency bandwidth for low-frequency accuracy. ? I assume people refers to me in particular. How does a single instruction cycle resolution PWM preclude you from dithering? In fact, I've done just that with the routine referenced above. I've got a version that will produce a 12-bit analog value by "dithering" 16 consecutive 8-bit values. > View the problem as that of a PID controller. The I term (integral) will > correct for low-frequency offset & drift. > > By dithering duty cycle on a 1-instruction basis, resolution can average to > much better than 1-instruction times, if the averaging period is long. Exactly... BTW, If you want, another way to increase the dynamic range is combine PWM with a D/A. For example, a simple R2R network can provide M-bits, while the PWM portion can provide the remaining N-bits. However, like the N/M PWM this will have several combinations of M and N that produce the same value. Scott -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.