From: JosephKK on
On Tue, 01 Jun 2010 22:01:47 GMT, Jan Panteltje
<pNaonStpealmtje(a)yahoo.com> wrote:

>On a sunny day (Tue, 1 Jun 2010 21:49:56 +0000 (UTC)) it happened Cydrome
>Leader <presence(a)MUNGEpanix.com> wrote in <hu3va3$f11$1(a)reader1.panix.com>:
>
>>> The reference values are in the 8 bit registers red, green, and blue.
>>> The registers red_sum, green_sum, and blue_sum are also 8 bits wide.
>>> The reference value is added each loop iteration to the sum value,
>>> when overflow a carry results, and the LED is set 'on', if no carry the LED is set 'off'.
>>> If you add a little bit (say low value for red) then it takes longer (more iterations) for the sum to overflow.
>>> If you add a lot, then the sum overflows more often, you get more ON states per number of loop iterations, so per time.
>>
>>
>>Is it correct to say you're really changing the duty cycle of on and off,
>
>It depends how you look at it.
>Of course I change the duty cycle, but like this:
>
> -- -- --
>| |__________________________| |__________________________| |__ dimmer
>
> -- -- --
>| |__________________| |__________________ | |________________ brighter
>
>
>See, now the frequency is higher, and the off time versus on time has decreased, the LED is brighter.
>
So it's PFM really. Small matter, it gets the job done.