Go Down

Topic: Library for TLC5940 16-channel PWM chip (Read 35 times) previous topic - next topic

acleone

Quote
I'm trying to fade multiple LEDs, independently, and at different rates. Is it possible to have the TLC5940 (or the arduino, for that matter) to run a series of "analogWrite" commands independently?

In other words, send one "fade channel0 from 4095 to 0 in 5000ms" and, before it's finished, send "fade channel1 from 0 to 4095 in 2500ms".

I know I could chain them together, so that as soon as channel0 finishes its fade, channel1 would begin...but that's not what I'm aiming for.


I'm writing some improvements this weekend that changes to the way the library handles the BLANK pulses, and I think it would be pretty easy to add fading too:
1. When we pulse BLANK, check to see if any fades should happen, and calculate the PWM output
2. set an "updated" flag or something to let the user know they should call updatePWMs(). <- I don't think you could call updatePWMs() in 1. because it would put too much code in an interrupt, breaking Serial and stuff

The changes I'm making to the way BLANK pulses:
- Instead of outputting BLANK as a PWM on TIMER1, use TIMER1 to count GSCLK pulses and call an interrupt to pulse BLANK.

nphillips

Nice! I think I understand what you're talking about...but not really  :-? I'm new to all of this

Thanks for all of your work, acleone! I'm eager to see what changes you're able to make over the next few days!

acleone

woot! Ti shipped me more TLC5940 samples today!

The project that I've been working on is building a 4096^3-colors version of SpokePOV that uses a secure-digital card for storage, so full video should be possible.

lwhi

Your project sounds impressive - does that mean you'll be controlling 3x30 led outputs?  are you going to need 6 TLC5940 to control the lot - or is it possible to multiplex the TLC5940 output pins?

acleone

Quote
Your project sounds impressive - does that mean you'll be controlling 3x30 led outputs?  are you going to need 6 TLC5940 to control the lot - or is it possible to multiplex the TLC5940 output pins?


I wasn't planning on multiplexing, so at least 6.  I'm assuming that a single rotation of the wheel will have ~30 PWM periods, which means one image is (24 bytes per tlc)*(6 tlc's)*(30 periods) = 4.32KB.  That comes out to ~231 frames per 1MB of SD card space.  

Go Up