[dorkbotpdx-blabber] another LED array question

David Frech nimblemachines at gmail.com
Tue Dec 16 18:32:52 EST 2008


This thread is kinda fun, so I thought I'd chime in.

You can divide your long shift register into several smaller ones
without taking up too many more io pins on the Arduino (or whatever
chip is driving the array). It may not be _necessary_ to do this, but
it's nice to know that it's both possible and easy.

Since you're driving 120 pins with 8-bit chips, that's 15
shift-reg/driver chips. If we hook them us as three chains of five
chips each, and arrange things so that not all sub-chains need to get
updated all the time, it's possible to do things quicker, since you're
driving shorter chains. If you always have to update all chains, this
is no faster.

To wire it up, SCLK (from AVR) goes to _all_ shift clock inputs on the
shift register chips, and the serial in (of the first three chips in
each chain) are wired _in parallel_ from the AVR MOSI (serial out)
pin. The chains are cascaded in the usual way, with serial of one chip
driving the serial in of the next.)

Then choose any three digital outs - one per chain - and use these to
strobe (clock) the serial shift register into the LED driving register
_but only on the chips you want to update_ (ie, each output drives the
five chips in one chain).

This way you always shift the shift registers, but you only update the
chips you want to update.

This may be more complex than needed for this application, but it's a
useful approach in general.

BTW, I didn't know about the TI TPIC6C596N chips. They are pretty
sweet. But I can't tell how the 596 is different from the TPIC6C595N
(which is obviously modeled on our old friend the HC595). Can anyone
enlighten me here?

- D

On Mon, Dec 15, 2008 at 11:03 PM, Paul Stoffregen <paul at pjrc.com> wrote:
>
>> 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
>>
>>
>
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>



-- 
If I have not seen farther, it is because I have stood in the
footsteps of giants.


More information about the dorkbotpdx-blabber mailing list