Maker Pro
Maker Pro

problems with 74HC165 PISO Shift Register

Hi,
I am having issues reading the data out of a 74HC165 shift register. Initially I had it hooked up to an attiny85, but I couldnt seem to get the correct reading, so I broke it down to the most basic possible schematic. I am completly a newb at electronics so dont hurt me too much ;D

(resistors in image are 10k not 220)
74HC165_ManualTest_bb.jpg



The output (Q7) on which the led is connected flickers randomly, when I dont press anything. also pressing the PL and CL as follows:
PL:HIGH
PL:LOW
PL:HIGH
LED should show DIP 1
CL:HIGH
CL:LOW
LED should show DIP 2

does not deliver the expected results, but allways delivers random results each time.

Any ideas on where the problem ist?
 
I think pin 1 and 2 will float high with the switches open?
So pull pin 1 and 2 low with a 1K resistor and see if that helps?

You might also get a bit of switch bounce so allow for that
 
Last edited:
Thanks, adding a pulldown on pins 1&2 solved the flickering issue, but the data that is outputted still does not quite fit...

what is switch bounce?
 
Switch bounce, will give multiple edges (shifts) from one switch closure.

Pin 10 may need to be tied low?
 
Last edited:
ah, ok, that may explain it.... the spec says right shift... I take it that means that I get D7 first? so the whole byte backwords? hmmm... I guess Ill just atach the attiny and try it again :) thanks again.
 
Ill try that... strange thing is, if I flip pin 8 of the dip switch to on, the ouput of the shift register goes to on and stays that way...
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Your problem is that there are inputs to your chip left floating.

You have done *exactly* the right thing with your 8 data inputs, having pull-up resistors (presumably, you don't show the power supply connections)

However, you have failed to do that for the inputs connected to the push button switches.

I guess the switches are pulling to ground(???) If so, you'll need 2 more pull-up resistors. And yeah, 10k is fine.

Check that there are no other inputs left floating. Generally you would pull them high or low as appropriate.

Then you'll have another problem. The buttons will bounce. This is especially a problem with the clock input. You will find that the data will not clock out as you expect, If you're lucky you'll see a few missing positions, if you're not and get 8 or more bounces, you may see nothing.

You need t either go back to the uC to generate pulses, or investigate "debouncing". You DEFINITELY need to investigate debouncing as you may need it for microcontroller inputs too. Note that you can do it in software for a uC which is clearly easier on numbers of components, but requires a larger program.

edit: and clearly this response is far too late :)
 
Might be worth checking that Sw8 it going to a parallel input and not somewhere else :)

Daisy chains would be the input for the register if its the second chip in the line, 9th shift after the data fell off the edge in the first chip (8 bits wide).
So check the data sheet to see if it needs to be tied low for single chip applications.
 
Last edited:
hi Steve,
yes, Ive done all that allready, and have switched back to the attiny85. I left the data on the led though and added a delay for each shift so I could see it blink if I set the dip to 10101010. unfortunately strange things happen :)
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
I'd pull pin 10 low and see what happens.

Pin 10 is an input and MUST be tied somewhere and not left floating.

You realise that after it has pumped out 8 bits it will need you to load some more?

You could connect pin 10 (the serial input) to the output pin so that it clocks the data around in a loop.
 
when I set the PL to LOW then HIGH doesnt it fetch the current button settings and start the shift at the beginning again?
 
PL needs to be pulled low to get new data latched in, then high to stop more data entering, while shifting.
So the push button switch need to go to ground and the resistor to VCC on pin 1, to hold PL high while shifting.
 
I was looking at the switch on the breadboard
Just make sure pin 1 goes low to load the data in and high while applying a clock pulse to pin 2 to shift.
You can see this from the timing diagram on page 5, it shows pin 1 as PL (active low) and pin 2 as CP (clock)

Pin 10 (DS) seems to be low all the time
 
Last edited:
The issue has been resolved, thanks,

it seems to be the button bouncing thing and it didnt work with the atTiny due to a programming error.

It seems to work now, with the exception of the 8th bit, when I use the attiny though the data which I am recieving does not match the pin number. I am guessing that this is due to either the programming or strange circumstances such as the one surroding the 8th bit...

Thanks for your help.
 
Top