Shift In registers with pull-up/down resistors?

Greets

I'm trying to find a shift register IC (parallel ins to serial out) with pull-up or pull-down resistors. Are there any?

http://www.ebay.com.au/itm/74HC165-8-bit-parallel-in-out-Shift-Register-IC-/270983593086?pt=AU_B_I_Electrical_Test_Equipment&hash=item3f17e17c7e

how about that?

do you know where in the data sheet it reads that they have pull-up/down resistors?

http://www.mouser.com/ds/2/389/CD00000273-91757.pdf

I am not aware of any shift registers that have internal pullup or pulldown resistors. However, some I/O expanders do, for example http://ww1.microchip.com/downloads/en/devicedoc/21952b.pdf.

If the application is to read a large number of push buttons, then I would consider wiring them in a diode matrix instead, then you may not need any shift registers. For example, a 5 x 5 matrix and 25 diodes (or 5 diode networks) will let you connect 25 push buttons using 10 pins, and some of those pins can usually be shared with other devices such as LCDs.

I will have at least one 4x4 keypad, most likely two, so yes, a diode matrix might be more suitable. I've never worked with one, I just used code to scan trough the 4 rows one column at a time, not sure if the diode matrix has advantages?

Or maybe I should use one shift register per one 4x4 keypad matrix? i.e. hook up the matrix's 4 row and 4 column pins to the 8 pins on the shift register and then have Arduino code translate the output of the shift register?

naut:
I will have at least one 4x4 keypad, most likely two, so yes, a diode matrix might be more suitable. I've never worked with one, I just used code to scan trough the 4 rows one column at a time, not sure if the diode matrix has advantages?

The reason for using diodes is that with them, you can handle multiple keys being down at the same time. If you don't care about that, then you can omit the diodes. 4x4 keypads are typically wired internally as a matrix (without diodes) anyway. See the keypad library for how to drive them.

naut:
Or maybe I should use one shift register per one 4x4 keypad matrix? i.e. hook up the matrix's 4 row and 4 column pins to the 8 pins on the shift register and then have Arduino code translate the output of the shift register?

To drive a 4x4 matrix you need 4 outputs and 4 inputs, so you can't use a single 8-bit SIPO or PISO shift register.

The reason for using diodes is that with them, you can handle multiple keys being down at the same time. If you don't care about that, then you can omit the diodes.

Well you can do it without diodes as long as your code checks each row and column one at a time, i.e. row 1 column 1, row 1 column 2, row 1 column 3..... etc.... at least that's how I did it. Of course if you can press, hold and let go of multiple buttons simultaneously faster than the Arduino can run through all the row/column combination you'll have a problem... but can you be that fast?

To drive a 4x4 matrix you need 4 outputs and 4 inputs, so you can't use a single 8-bit SIPO or PISO shift register.

Does anyone here have a code example (tutorial)?

naut:

The reason for using diodes is that with them, you can handle multiple keys being down at the same time. If you don't care about that, then you can omit the diodes.

Well you can do it without diodes as long as your code checks each row and column one at a time, i.e. row 1 column 1, row 1 column 2, row 1 column 3..... etc.... at least that's how I did it. Of course if you can press, hold and let go of multiple buttons simultaneously faster than the Arduino can run through all the row/column combination you'll have a problem... but can you be that fast?

That doesn't completely work if 3 buttons are down and 2 of them are attached to the same row. For example, if buttons R1C1, R1C2 and R2C1 are pressed, then C1 is shorted to C2, so that both C1 and C2 activate both R1 and R2. So the code can tell that at least 3 of R1C1, R1C2, R2C1 and R2C2 are pressed, but not which ones. However, you can still detect that a problem exists, and stop registering keypresses until it goes away.

naut:
Does anyone here have a code example (tutorial)?

Joe Young has a library that uses two SPI port expanders for matrix keypads.

He includes documents, spec. sheets, and examples on how to connect and use the port expanders. Also, if you need to press more than one key at a time it might be wise to follow dc42's advice and use diodes. However, most people are just fine using keypads without diodes.

Note: If you only need a single key returned then use the Keypad_I2C getKey() method instead of the getKeys() method which is multi-key.