Martwana
Posts: 30
Joined: Sun Dec 16, 2012 1:12 pm

74HC164N Daisy Chain Problem

Sun Feb 17, 2013 4:15 pm

Hello again, its been a while.

I'm having a bit of trouble daisy chaining some '164 shift registers.

I have the first hooked up fine, and it works as expected, but by hooking output 8 of register 1 to input a (also tried input b and input a&b and tying one high and low) and joining the clock and clear pins of the first to the second, it just doesn't work.

To test them, I've simply been shifting out(using wiringPi's shiftOut) 1 in a loop, incrementing by 1 each time, so its basically a binary counter.

Can someone please explain what the proper way to set these up is.

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: 74HC164N Daisy Chain Problem

Sun Feb 17, 2013 5:39 pm

Connect the CLK and /CLR pins of each chip together with CLK going to your GPIO driving the clock and /RST going to your GPIO for resetting the shift registers. Connect QH output(last) of the first shift register to DSA and DSB of the second shift register. Connect DSA and DSB of the first shift register to your GPIO providing the data bit.
2x164.png
2 '164 shift registers
2x164.png (16.1 KiB) Viewed 1562 times
Enjoy!
Bill

Martwana
Posts: 30
Joined: Sun Dec 16, 2012 1:12 pm

Re: 74HC164N Daisy Chain Problem

Sun Feb 17, 2013 6:06 pm

That is exactly as I have wired, but it refuses to work.

I just retired it there, to check, but still no output from the second one at all

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: 74HC164N Daisy Chain Problem

Sun Feb 17, 2013 6:22 pm

Try:
GPIO data out > chip1 A and B parallel with chip 2 A and B, also GPIO clk out > chip1 clk and chip 2 clk.
If they dont behave the same swap chips (easy if breadboard project or socketed as you should do)
>)))'><'(((<

Martwana
Posts: 30
Joined: Sun Dec 16, 2012 1:12 pm

Re: 74HC164N Daisy Chain Problem

Sun Feb 17, 2013 7:21 pm

aTao wrote:Try:
GPIO data out > chip1 A and B parallel with chip 2 A and B, also GPIO clk out > chip1 clk and chip 2 clk.
If they dont behave the same swap chips (easy if breadboard project or socketed as you should do)
That works fine, they work in tandem there fine.

Heres what I'm, trying to do, just to get it working. i have 13 LEDs connected to the outputs of the shift register. The rightmost led is connected to reg1 out1, and on and on so the 13th led on the leftmost side is connected to reg2 out6.

to turn on the leftmost 4 leds i am clocking 001111000000000 into the registers, which is equal to 7680, and 7680 is what i use in shiftOut().

it doesnt work. when i go back to i=0;;i++ shiftOut(i); it looks like the two registers are outputting the exact same even though reg2 inputs are connected to reg1 out8.

i dont get it

help

Martwana
Posts: 30
Joined: Sun Dec 16, 2012 1:12 pm

Re: 74HC164N Daisy Chain Problem

Sun Feb 17, 2013 7:46 pm

I now seem to have fixed it by modifying Gordon Hendersons shiftOut();

Heres the one that works for me. I stripped out the dPin, cPin and ORDER options, as its only really intended for my use.

Code: Select all

newShiftOut(int val){
int i;

        for(i = 15; i>=0; --i){
                digitalWrite(dataPin, val & (1<<i));
                digitalWrite(clockPin, HIGH);
                digitalWrite(clockPin, LOW);
        }
}
Basically, uint8_t and int8_t are limited to 255 and 127, so by swapping them to simple int's, it all works fine.

I also modified the for loop to start at 15, so it clocks across both registers all at once.

Works for me. :)

Return to “C/C++”