# Shift register m74hc165 connection

I am following the following tutorial (http://www.arduino.cc/en/Tutorial/ShiftIn) to connect a shift-in register to my Arduino. In the tutorial they use a CD4021 'CD4021' shift register and I got a 'm74hc165'. After looking at the datasheet (http://www.datasheetlib.com/datasheet/735260/m74hc165b1_sgs-thomson-microelectronics.html#datasheet) I cannot figure out how to connect the following wires:

Q8 (pin 3) to Ardunio DigitalPin 9 (blue wire)
CLOCK (pin 10) to to Ardunio DigitalPin 7 (yellow wire)
P/S C (pin 9) to Ardunio DigitalPin 8 (green wire)


Mentioned in the tutorial in section 2. Can somebody help me with how to connect these three wires to the shift-register?

Comparing the two devices the basic difference is that the PL input (parallel load) is active high for CD4021 and active low for 74HC165 so you need to invert the digital state of the pin that drives it accordingly.

The connection doesn't change from the one shown in the link, only the pin numbers.
Also note that Q8 (pin 3) to Ardunio DigitalPin 9 (blue wire) is a mistype, it should say Q7 (pin 3) to Ardunio DigitalPin 9 (blue wire)

Your connection for 74HC165 should be

Q7 (pin 9) to Ardunio DigitalPin 9 (blue wire)
CLOCK (pin 2) to Ardunio DigitalPin 7 (yellow wire)
P/S C (pin 1) to Ardunio DigitalPin 8 (green wire)

• Thus you say I should change the code, but the wiring give in the tutorial if correct? I'll test your active high->low state tomorrow and let you know. If you only can confirm the wiring that would be great. – Pakspul Jan 17 '14 at 22:54
• @Pakspul I have included the wiring in my reply, the two IC have different pinouts so you should connect different pins to the arduino for Q7,CLOCK and PL (shown as P/S) – alexan_e Jan 17 '14 at 22:56
• Thank you, i get a result of 11111111 in my arduino, but something weird still happens. If i don't press any buttons the result changes, and in weird numbers (i.e., 110, 1101 etc) don't know why. I understand the idea and will go further with it when i'm ready for it. – Pakspul Jan 18 '14 at 9:05
• @Pakspul You can also check a couple of other resources like this one and this one – alexan_e Jan 18 '14 at 9:19