From: Jan Panteltje on
Ethernet based RGB LED strip controller, released an other 11848 lines of asm under the GPL.
makes 14476 bytes of program memory, 16k almost full...

http://panteltje.com/panteltje/pic/ethernet_color_pic/

This one uses some power MOSFETS, so it should be able to drive many meters of RGB LED strings.


One would almost think I did not know about C...
hehe
asm is cool.
From: Cydrome Leader on
Jan Panteltje <pNaonStpealmtje(a)yahoo.com> wrote:
> Ethernet based RGB LED strip controller, released an other 11848 lines of asm under the GPL.
> makes 14476 bytes of program memory, 16k almost full...
>
> http://panteltje.com/panteltje/pic/ethernet_color_pic/
>
> This one uses some power MOSFETS, so it should be able to drive many meters of RGB LED strings.
>
>
> One would almost think I did not know about C...
> hehe
> asm is cool.

nice project but one question- If you're using PWM, why is the frequency
use to drive the LEDs changing?
From: Jan Panteltje on
On a sunny day (Tue, 1 Jun 2010 15:47:35 +0000 (UTC)) it happened Cydrome
Leader <presence(a)MUNGEpanix.com> wrote in <hu3a2n$125$1(a)reader1.panix.com>:

>Jan Panteltje <pNaonStpealmtje(a)yahoo.com> wrote:
>> Ethernet based RGB LED strip controller, released an other 11848 lines of asm under the GPL.
>> makes 14476 bytes of program memory, 16k almost full...
>>
>> http://panteltje.com/panteltje/pic/ethernet_color_pic/
>>
>> This one uses some power MOSFETS, so it should be able to drive many meters of RGB LED strings.
>>
>>
>> One would almost think I did not know about C...
>> hehe
>> asm is cool.
>
>nice project but one question- If you're using PWM, why is the frequency
>use to drive the LEDs changing?

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.


This is executed in main in a loop:

; do the PWM thing
do_rgb:
do_red:
bcf STATUS, C
movfw red
addwf red_sum
btfsc STATUS, C
goto red_on
; red off
bcf RED_PWM
goto do_green
red_on:
bsf RED_PWM
nop

do_green:
bcf STATUS, C
movfw green
addwf green_sum
btfsc STATUS, C
goto green_on
; green off
bcf GREEN_PWM
goto do_blue
green_on:
bsf GREEN_PWM
nop

do_blue:
bcf STATUS, C
movfw blue
addwf blue_sum
btfsc STATUS, C
goto blue_on
; blue off
bcf BLUE_PWM
goto col_done
blue_on:
bsf BLUE_PWM
nop
col_done:

; do other things

goto do_rgb
From: Cydrome Leader on
Jan Panteltje <pNaonStpealmtje(a)yahoo.com> wrote:
> On a sunny day (Tue, 1 Jun 2010 15:47:35 +0000 (UTC)) it happened Cydrome
> Leader <presence(a)MUNGEpanix.com> wrote in <hu3a2n$125$1(a)reader1.panix.com>:
>
>>Jan Panteltje <pNaonStpealmtje(a)yahoo.com> wrote:
>>> Ethernet based RGB LED strip controller, released an other 11848 lines of asm under the GPL.
>>> makes 14476 bytes of program memory, 16k almost full...
>>>
>>> http://panteltje.com/panteltje/pic/ethernet_color_pic/
>>>
>>> This one uses some power MOSFETS, so it should be able to drive many meters of RGB LED strings.
>>>
>>>
>>> One would almost think I did not know about C...
>>> hehe
>>> asm is cool.
>>
>>nice project but one question- If you're using PWM, why is the frequency
>>use to drive the LEDs changing?
>
> 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,
but not at fixed rates as in true PWM, and this rate is based off how fast
you overflow?

> This is executed in main in a loop:

[I can't read assembler so I'm truncating the code]

From: Jan Panteltje on
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.