# Understanding shift-registers

When working with multiple shift-registers that are linked together, there's one thing I don't quite get. When shifting data out, it goes from the first register to the next, to the next, and so forth down the line till it reaches the last one which then pitches it when the next set of bits come in. Let's simplify, let's say I have 3 shift registers, A, B, and C. Data flows from A -> B -> C

So a set of bits will get to the C register on the third pulse. But what if what I want to show on C isn't what just went through B? What if only the data that's on the C register changes, while A and B remain the same? Do I push everything out and replace it with new data? So if I happen to have 8 registers linked together and only want to change what's on the 6th and 8th register, essentially I'm pushing a whole new set of 8 instructions again (one per register)?

Seems abit inefficient ... or I'm not understanding them correctly.

How you use multiple shift registers is a trade-off between time and data pins. If you have three 8=bit shift registers hooked in series you only need one output pin and one shift pin (2 pins total). You then have to shift in 24 bits to get the values you want on all three shift registers. If you give each one a separate output pin and shift pin (6 pins total) you can set any of the three registers to whatever values you want with 8 shifts each. An intermediate choice is to have separate output pins but a common shift pin (4 pins total). You still have to provide all 24 bits of data but you can do it in 8 shifts instead of 24.

You use a shift register to save data pins. In the process you lose update speed.

You should be using 3 control pins now - dataout, clock, and output clock (to move the data from the serial shift-in register to the output drive registers).
So add 2 more control pins, and have separate output clocks for each device.
Then have the data and clock go to all three devices in a parallel. Each will shift the same data into their serial shift-in register, but only the device getting an output clock will have its output changed.
As JohnWasser says - trade pins for speed.
You can also use hardware to shiftout faster - look into SPI for transfers.

Presumably giving each one separate pins, it's slightly faster than having everything in series using the same three pins, correct? I would only be shifting out 8-bits at a time, as opposed to 24-bits each time?

That’s correct KirAsh. You could update Reg C three times, never have to touch A & B for example.

Okay. I should be getting a ton of them next week so I'll start playing with them, see how many I will blow up.

What kind are you getting?
I recently purchased 20 of 74AC299PC from Newark.com. Good current source & sink (24 mA each way) and can function as both shift in and shft out register and also shift both left & right.
All for 56 cents too.

Regular 74HC595s from Jameco.

Got 30 for 29 cents each.

Yes, but tHC595's are only shift-out, and only in one direction. And are only spec'ed to drive hi & lo levels at +/- 6mA with 4.5V VCC. Above that, who knows what kind of level you will see. Maybe you were planning to drive 2 LEDs in series - only the voltage level 'droops' so much that only 1 will turn on.
The 74AC299 will drive the +/-24mA, and can be used for shift-in or shift-out, and can shift left & right. Lot more capability there that can be taken advantage of.

Hrm, the spec sheet from Jameco says 2-6V (operating values) with a DC Output max current per pin of 35mA, and a DC VCC or GND max current of 70mA per pin. Clamp diode max of 20mA. Those are all max values, which I don't intend on hitting anyway.

I also have some of these coming: TLC5940 data sheet, product information and support | TI.com

Ok, there’s a difference between Absolute Maximum Ratings, which have these caveats, note the 2nd sentence!

"(1) Stresses beyond those listed under absolute maximum ratings may cause permanent damage to the device.

These are stress ratings only, and functional operation of the device at these or any other conditions beyond those indicated under recommended operating conditions is not implied. <<<
Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.
(2) The input and output voltage ratings may be exceeded if the input and output current ratings are observed."

and Recommended Operating Conditions.
Thus if one sinks/source more than +/- 6mA with VCC at 4.5V or 7.8mA at Vcc = 6V than proper high & low levels may not be achieved, and the results may not be as expected. An example is 2 LEDs in series not turning on as expected as I noted above.
Or the part may just fail prematurely.