chain from 3 x 74hc165 shiftin registers

int clockEnablePin  = 9;  // Connects to Clock Enable pin the 165

Not according to the schematic it doesn't. But it is tied to GND so I think that's ok.

I would decouple those chips and see what happens then.


Rob

No. My scheme is identical to one i drew.

Then you need some.

Then you need some.

I would decouple those chips and see what happens then.

How can i decouple them? So, i need external power source to be able to run more then 2 registers in the chain?

So, i need external power source to be able to run more then 2 registers in the chain?

No. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Grumpy_Mike:

So, i need external power source to be able to run more then 2 registers in the chain?

No. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

So I need to place capacitors? But where and what kind of capacitors? Sorry, it quite difficult for me to understand principles of De-coupling.

Am i right??

Close. The 0.1uF ceramic ( only ceramic ) capacitors should be placed as close to the chip’s pins as you can get them with the leads on the capacitors as short as possible.

The same problem. (((

Pin0(from the last chained register(the farest from arduino)) - work ok pin1 - ok pin2 - ok pin3 - ok pin 4 - ok 5- ok 6 - not ok(displayed as 6 and 7 pins at the same time)

7 - not ok(displayed as 6 and 7 pins at the same time)

next register 8 -ok 9 - ok ... 14 - ok 15 - not ok! (Shown as 15 - 23 pins pressed at the same time)


1-st register 14 - 23 pins do not work at all.

Try this modification:-

 /* Pulse the Clock (falling edge shifts the next bit).
        */
        digitalWrite(clockPin, HIGH);
        delayMicroseconds(PULSE_WIDTH_USEC);
        digitalWrite(clockPin, LOW);
        delayMicroseconds(PULSE_WIDTH_USEC);

It doesn't help. ((( I trying to fing examples with 3+ registers or more... without success for now>

Did you write that code or get it from somewhere else? The comment about clocking edge was wrong, as was the name of the variable for the CE pin, it is chip enable not clock enable. It won't affect the results but shows the person who wrote the code only has a flimsy grip on what is going on.

I found this code. I just wanna look out is it works and then try to adopt it for my needs. I need just simple function like if (buttonX == 1) { DigitalWrite (X, HIGH) } But, yeah. I can't move forward before it start to work at least with someone's test code.

Anyone? Is there the way to use more then 2 input registers?

http://dduino.blogspot.com/2012/04/arduino-74hc165-psio-shift-regsiter.html

I've looked at that code 10 times and I can't see any reason it will work for 2 chips and not for 3. I would however change

       bytesVal |= (bitVal << ((DATA_WIDTH-1) - i));

which I think is unnecessarily complex and time-consuming to

        bytesVal << 1;
        bytesVal |= bitVal;

I can't see that has anything to do with the problem but code that's difficult to understand is always worth changing.


Rob

http://www.gammon.com.au/forum/?id=11979

Hey Black_Parrot,

I just read your post and see some similarities to my post. Especially the case that two inputs fire the same time happens to me as well. I do use two SN74HC165N daisy-chained.

Here is my story: http://forum.arduino.cc/index.php?topic=222209.0

Let me know if you are making progress. I will keep you posted.

Thanks, Musterstrasse

Are we having fun yet? Anybody need help here? I worked out a sketch of my own, if anyone is interested - Reply. (Didn't want to just go and cast pearls before... well, anyway.)

Graynomad: I've looked at that code 10 times and I can't see any reason it will work for 2 chips and not for 3.

I am with Rob, he must have a hardware problem not a code issue.

I found this solution to make the example found here http://playground.arduino.cc/Code/ShiftRegSN74HC165N work with 3 or 4 chips: just change this line byte bitVal; found in the read_shift_regs() function into this one

long bitVal;

and it seems to work fine. Hope it helps.