Interfacing the BS2 to a TLC5940
billiam
Posts: 12
My eventual plan is to have my BS2-SX work as a controller for 16 RGB LEDs. I recently bought 3 TLC5940s to drive the LEDs. Since the LEDs aren't in as of yet, I am testing the chips out with a 5x6 red LED matrix that I whipped up last night.
So far, using the datasheet and programming flowchart, I've wrote a program that will turn all 30 LEDs on, but I am confused on a few points.
I've attached my code and here is the programming flowchart www.ti.com/litv/pdf/slvc106 that my code is based on. My code is peppered with little comments about what I was thinking / trouble I had at the time of writing. (I'm new so be nice haha)
So, anyways, I assumed when I first looked at these chips that there would be a way that I could set and forget the LEDs. I'd like to end up with a procedure set_led or something like that which would set a certain LED to a certain brightness, and that would hold until I set it differently.
According to the flowchart, there's the GSCLK which is to be pulsed 4096 times. Why 4096, and why does it constantly need to be pulsed? How could I achieve my set and forget procedure?
Also, 4096 clock pulses seems to take about a half second on the stamp. Having to pulse GSCLK 4096 times for every grayscale change would render fades impossible.
There has to be something that I am not seeing here, help!
Thanks!
So far, using the datasheet and programming flowchart, I've wrote a program that will turn all 30 LEDs on, but I am confused on a few points.
I've attached my code and here is the programming flowchart www.ti.com/litv/pdf/slvc106 that my code is based on. My code is peppered with little comments about what I was thinking / trouble I had at the time of writing. (I'm new so be nice haha)
So, anyways, I assumed when I first looked at these chips that there would be a way that I could set and forget the LEDs. I'd like to end up with a procedure set_led or something like that which would set a certain LED to a certain brightness, and that would hold until I set it differently.
According to the flowchart, there's the GSCLK which is to be pulsed 4096 times. Why 4096, and why does it constantly need to be pulsed? How could I achieve my set and forget procedure?
Also, 4096 clock pulses seems to take about a half second on the stamp. Having to pulse GSCLK 4096 times for every grayscale change would render fades impossible.
There has to be something that I am not seeing here, help!
Thanks!
bsx
2K
Comments
It looked like more work to interface than I'd like to get involved with. The GSCLK looked like a PWM clock with a 12-bit counter that wrapped around every 4096 clocks. You'd probably drive this from some kind of external oscillator, maybe a 555 timer in asynchronous mode.