Teensy Shift Register issue

Status
Not open for further replies.

BenDanville

Active member
Hi hoping someone can help me, thanks in advance for any advice!

I am trying to replicate the official arduino example for SN74HC165N shift registers, I have replicated the diagram and code here:
http://playground.arduino.cc/Code/ShiftRegSN74HC165N
The datasheet is here:
https://www.sparkfun.com/datasheets/Components/General/sn74hc165.pdf

When I have just 2 shift registers as per the code it works fine, if I extend it to 4 shift registers (following the logic of the diagram) and change the variable in the code to 4 then only the 2nd and 3rd shiftregister inputs work.
I noticed they have nothing to the Vcc so I have tried adding 5v to the VCC on each shift register but that also did not work.
I have tried with both a Uno and a Teensy2++ with the same results.

Does anyone have an idea what I'm doing wrong?
I see in other examples people use capacitors (even sparkfun's breakout for this shiftregister) but I am not sure how I would add that in?

Thanks again!
Ben

P.S. I am trying to get this working because I am interested in making a universal board I can use for 3 different projects with many many buttons (Custom keyboard, Midi controller, Flight sim switchboard)
 
Last edited:
why not a gpio expander? i have 8 dips on a pcb giving me 128 gpio, theres a company in the uk selling an rpi version with smt 8x23x17 i2c/spi, i already did the pinout and used it as a test on teensy and it works with my code, you can use majenkos library for the spi version

just saying... :)
 
I take it this is an first or second arduino project?

A photo of your setup would be good, especially how the power,gnd and daisy chain signals are flowing. Having chip 1 not work and 2 work is very suggestive of a wiring mishap rather than code problem.

Unsure what flavor capacitors they are using here, unless they are trying to tame switch bounce.

An alternative depending on your wiring layout may be to look at the keypad library
http://playground.arduino.cc/Code/Keypad

You may need more wires, but can be a simpler layout and coding experience.
 
As mentioned above (and forum rules), it would really help in cases like this to see a picture that shows the hookup as well as the actual code you are trying.

It often does not help to say the code came from ... as their may be subtle issues. For example if the code works for 2 shift registers, but not 4,
It sometimes could be something as simple as the code uses variables like uint16_t to hold the values which works fine for 2, but you would then need to extend to uint32_t to work for 4... But again only throwing darts!
 
Thanks tonton81, GremlinWrangler, KurtE, manitou for your advice!

It works now!
I feel stupid but it was the fact I hadnt changed from int to long thanks manitou, I guess I got too caught up in assuming I made a mistake in my wiring that I must have skimmed that section.

Thanks tonton81 I will have a look, I already had a stick of the shift registers I bought in a clearance deal so I thought they would be educational.

GremlinWrangler I appreciate your point, I didnt really give enough information. I am a electronics newbie, made many projects but all just simple button/switch input based projects.

KurtE Thanks, sorry I should have provided more info.

Thanks everyone for helping sort this out!


fms_shift_register_board.jpg
 
Status
Not open for further replies.
Back
Top