> Both approaches have a further limitation in that there isn't any
> "good" time to change the output value without causing some
> disturbance (e.g. if the output value goes from 7 to 8, there
> may be an interval in which 15 consecutive zeroes or ones are
> output.

Ah! Now there's an advantage of the "Stamp" method (AKA DDS or Direct
Digital Synthesis). Instantaneous change in the "width" value will be
smoothly incorporated into the bitstream.

Particularly useful if used not for PWM but for frequency modulating a
sinewave.
--
Cheers,
Paul B.

|> Both approaches have a further limitation in that there isn't any
|> "good" time to change the output value without causing some
|> disturbance (e.g. if the output value goes from 7 to 8, there
|> may be an interval in which 15 consecutive zeroes or ones are
|> output.

| Ah! Now there's an advantage of the "Stamp" method (AKA DDS or Direct
|Digital Synthesis). Instantaneous change in the "width" value will be
|smoothly incorporated into the bitstream.

| Particularly useful if used not for PWM but for frequency modulating a
|sinewave.

The ear is amazingly sensitive to phase distortions in audio; even
though the fractional-output (more accurate therm than PWM probably)
method I described is almost as good as the "stamp" method be any
normal metric (the "stamp's" worst-case error is +/- 1/2 lsb while
the method I gave is +/- 1 lsb and conventional PWM is +/- 1/2 MSB,
the phase noise produced by that 1/2 lsb error is quite noticeable if
the sine-wave table is less than 256 points (it's still slightly aud-
ible even then, but not too objectionable).

The biggest issues in determining which fractional output method is
best are:

[1] What frequencies and quantities of noise are acceptable?

[2] Will the signal get distorted prior to filtering (as it might if
it goes through optoes)?

[3] How much memory/codespace/time are available for computation?

[4] How many channels need to be synthesized and is any particular
phase relationship between them especially good or bad?

In many scenarios, some of these issues won't apply. But if, for
example, your PWM has to go through an opto whose turn-on time is
5us but whose turn-off time is 50us (not unknown when dealing with
photo-darlingtons) the higher-speed modulation tricks (where the
output frequency depends upon the value output) will yield very
non-linear conversions while fixed-frequency PWM will be linear
except when going from 0 to 1, or when approaching the very top of
the range.