[dorkbotpdx-blabber] another LED array question
Paul Stoffregen
paul at pjrc.com
Tue Dec 16 02:03:32 EST 2008
> is it true that with the right cascading pin connections between
> chips (shown in the datasheet, i think) somehow all
> N chips turn into one great big linear 12x24xN array, and
> i only have to shove 288xN bits down the serial link
> every time i want to update anything?
Yes, exactly.
The AVR has a port called SPI that makes this easy, and fast. You
connect the AVR's MOSI pin to the first TLC5947's SIN pin, and each SOUT
goes to the next chips SIN pin. SCLK from the AVR goes to all SCLK pins.
You only need 3 pins. Any digital out can go to all the XLAT pins. You
just pulse this pin after all the bits are shifted out to make them take
effect. The diagram shows 4 wires, but really you don't need to connect
a pin to all the BLANKs unless you want to be able to quickly shut
everything off without shifting out all zeros. Of course, connect all
those unused BLANK pins to ground so the LEDs work.
To use the SPI port, you just write to 2 registers.
SPCR = (1<<SPE)+(1<<MSTR);
SPSR = (1<<SPI2X);
That will activate the SPI port and configure it for maximum speed,
which is 8 MHz (or half of whatever your AVR's clock is).... you won't
get anywhere close to the chip's maximum speed of 15 MHz with any
currently available AVR chip.
The to shift out 8 bits, you just do this:
SPDR = some_8bit_number;
It takes 17 clock cycles to shift out, and then you can write to SPDR
again. There is a status bit that you can query to find out if it's
done sending the last byte, but it's faster (if you can stomache a tiny
bit of assembly) to just pad NOPs to get exactly 17 cycles between
writes to SPDR. In theory you can also use an interrupt with SPI, but
in practice it's useless at this high speed because it takes that long
just to get into and out of the interrupt routine.
There is one other gotcha with the SPI port. If the SS pin is an input,
it has to remain high, or else the chip thinks some other SPI device is
trying to write. The easiest thing is to just make sure you've got SS
configured as an output... maybe even use it to drive all those XLAT pins.
> it seems like that's
> what i'm reading: i just rewrite the whole shebang every time
> i want to make a change, rather than addressing each pin
> individually with an address+value. unless i'm getting
> this wrong. but i can do that, sure. at 15 mhz, that's
> still something over 10000 updates per second.
>
>
> On Dec 15, 2008, at 2:19 PMMonday, Greg Grunest wrote:
>
>> Yeah, that is an awesome chip too. I also noticed the SMT only
>> packaging
>> which is kind of a drawback. Has anyone hand soldered one of those
>> chips
>> with a thermal pad and been successful?
>
> i gotta say, the 24-channel chip is pretty nicely suited to this
> project. i guess i just gotta get real with my long-overdue
> PCB-design learning curve.
>
> qestion for jason/don/everybody: is it likely, assuming i can pull
> off a 1-sided pcb design correctly, that i would be able to
> get good enough resolution using the chemicals-in-the-sink
> method that i can use SMT or DAP or QFM chips? assuming i can
> muster the jedi-skills of microsoldering, would i even be
> able to get the teeny pads and traces right?
>
> my other anxiety is how to heat-sink them.
>
>> The 8-bit version that comes in dip packaging has a ton of
>> potential. I'm going to have to order a couple and see if they drive
>> hobby
>> servos. That would ROCK if you could drive 16 servos with two of
>> them all
>> from a serial line on the Arduino.
>
> when you say "the 8-bit version that comes in dip" do you mean
> the TLC5917, in "16PDIP"?
>
> the other thing my project needs is some stiff, poseable
> 4-wire leads terminated in some connector that i can just plug
> the 4 leads of an RGB right into. if the wire is poseable,
> then the PCB could look more or less like anything.
>
> -m-
>
> ---
> HELP! A Bear is Eating Me!
> http://helpabeariseatingme.com
>
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>
>
More information about the dorkbotpdx-blabber
mailing list