How to connect 74HC165 ?

Guys, I'm trying to use 2 chained 74HC165 to read 16 buttons. But the following link tutorial got me lost.

http://www.arduino.cc/playground/Code/ShiftRegSN74HC165N

I did find the correct PDF file, but I'm still lost on how to use the chip.

Any information would be much appreciated.

Thanks, Wk

Sorry to my mind the tutorial says it all. Can you be a bit more specific than the rather woolly "I'm a bit lost"

From the code:

int ploadPin = 8; // Connects to Parallel load pin the 165
int clockEnablePin = 9; // Connects to Clock Enable pin the 165
int dataPin = 11; // Connects to the Q7 pin the 165
int clockPin = 12; // Connects to the Clock pin the 165

You need the 74HC165 data sheet, of course.

Thanks guys, I get that, but how do I daisy chain two chips to get 16 inputs? :-[

Wk

Here is a diagram using a different microprocessor but the wiring should be about right.

Ah, very nice indeed. I had that page in another language. Nice to see in English. :sunglasses:

Best Regards, WilliamK

Yup, that one did the trick.

It was easy to setup, and it did even use less pins compared to the tutorial on the arduino site. :wink:

I also managed to get everything working with less code. Its very easy to understand indeed. Thanks again.

Wk

BTW: Vss is Ground on the picture, not sure if Vss is a common nomenclature?

Wk

I don't like to use 74HC164 ,74HC165 .I think 75hc595 is easier to use .

max232,
Any octal clocked register part could be used as shift register.
The right hand of this schematic shows 2 74F374s wired up as output shift registers.
I used these because:

  • I had them on hand
  • they can sink 24mA of current to turn some LEDs on
  • I didn't have any shift registers to play with.
  • I didn't care that there was the barest of flicker on the LEDs as the bits shifted thru.

They worked great with the standard shiftout commands.
// shift out highbyte
//shiftOut(shiftdataout, serialclock, MSBFIRST, (outdata >> 8));
// shift out lowbyte
// shiftOut(shiftdataout, serialclock, MSBFIRST, outdata);

MAX, realizing you like the 595 means you have need of OUTPUTS... but if you need inputs... it's just not the right device.

As stated by crossroads, there are MANY options related to shift registers and the handshaking required is nearly identical in all cases. So, master one chip, and all the rest should be so much easier.

Once you understand how CLOCK, SELECT or LATCH and DATA work it starts getting fun.

A long time ago I built an extendable relay panel that allowed you to add or remove a board with 8 INPUTS and 8 OUPUTS per board. I used an INPUT pin on the controller that was fed to the LAST OUTPUT of the last board. Essentially, it was a form of feedback... during STARTUP, the controller sends out a data bit and keeps shifting bits until it sees that feedback pin change state.

This way you can daisy chain shift registers and not need any special code each time you add and remove them.