Connect with us

problems with 74HC165 PISO Shift Register

Discussion in 'General Electronics Discussion' started by King_bob, Feb 8, 2014.

Scroll to continue with content
  1. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    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)
    [​IMG]


    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?
     
  2. mursal

    mursal

    75
    0
    Dec 13, 2013
    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: Feb 8, 2014
  3. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    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?
     
  4. mursal

    mursal

    75
    0
    Dec 13, 2013
    Switch bounce, will give multiple edges (shifts) from one switch closure.

    Pin 10 may need to be tied low?
     
    Last edited: Feb 8, 2014
  5. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    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.
     
  6. mursal

    mursal

    75
    0
    Dec 13, 2013
    Pin 10 may need to be tied low?

    Shift right would be D0 out first would it not?
     
    Last edited: Feb 8, 2014
  7. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    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...
     
  8. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    pin 10 is the input for daisy chains...
     
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,384
    2,771
    Jan 21, 2010
    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 :)
     
  10. mursal

    mursal

    75
    0
    Dec 13, 2013
    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: Feb 9, 2014
  11. King_bob

    King_bob

    12
    0
    Feb 8, 2014
  12. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    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 :)
     
  13. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,384
    2,771
    Jan 21, 2010
    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.
     
  14. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    when I set the PL to LOW then HIGH doesnt it fetch the current button settings and start the shift at the beginning again?
     
  15. mursal

    mursal

    75
    0
    Dec 13, 2013
    From the data sheet I think pin 15 (active low clock enable) will have to be low for the register to shift?
     
  16. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    To be honest I really dnt even understand what that does, but I have it at low anyway
     
  17. mursal

    mursal

    75
    0
    Dec 13, 2013
    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.
     
  18. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    do I need the pull downs on pin 1&2 when I have the Attiny connected?
     
  19. mursal

    mursal

    75
    0
    Dec 13, 2013
    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: Feb 9, 2014
  20. King_bob

    King_bob

    12
    0
    Feb 8, 2014
    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.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-