I have a Parallel Load Shift register (SN74HC165)

When connecting the parallel inputs, do I need to add a resistor to limit the current?

And if so, can I use one resistor for all 8 Inputs in total?

This is my intended circuit:


simulate this circuit – Schematic created using CircuitLab

  • 2
    \$\begingroup\$ are you planning to use a relay for the clock input of the shift register or its "shift/load" input? you'll notice that mechanical contacts bounce. \$\endgroup\$ – Marcus Müller Aug 8 '19 at 16:00
  • \$\begingroup\$ Yes, I was tempted to ask how this system is supposed to work. Noise, bounce, synchronization, (You may, or may not catch the relay closing). But then caught the name: "HackXIt" :-) \$\endgroup\$ – Oldfart Aug 8 '19 at 16:06
  • 1
    \$\begingroup\$ Heh, I've actually already been told that my setup isn't the best, simply because the relay could be replaced by an optocoupler. Regarding the bounce, I hadn't put much thought into it, as no clock is intended for this circuit. I'm doing a manual clock via GPIO's, and also manually setting it to "Load" mode. So yea.. it's quite amateur. \$\endgroup\$ – HackXIt Aug 8 '19 at 16:43

but you should add a pull-down resistor. Otherwise your input is floating when the switch is open.

May I know why it's unnecessary? Does the HC165 have an internal resistor or are there other factors I'm missing?

The HC inputs are very high impedance (Which means they have internally a very high resistance). They take hardly any current at all. In effect if you take the TI data sheet it specifies the input current when connected to VCC as a few uA.

That is also the reason why you should not leave an input unconnected. It needs only very, very little current (read: energy) to switch. It could already switch on the 50/60 electric field from a nearby power rail.

As to pull up and pull down and switches have a look at this post which shows you how to use a switch with either.

  • \$\begingroup\$ May I know why it's unnecessary? Does the HC165 have an internal resistor or are there other factors I'm missing? \$\endgroup\$ – HackXIt Aug 8 '19 at 16:46
  • 3
    \$\begingroup\$ HC165 does not have internal resistors. Unconnected pins will act like an antenna and will randomly read in as high or low. \$\endgroup\$ – CrossRoads Aug 8 '19 at 17:07
  • \$\begingroup\$ I'm a little confused now. One is saying pullup, you're saying pulldown and my personal knowledge is telling me pullup. Is there even a "best approach"? \$\endgroup\$ – HackXIt Aug 8 '19 at 18:56
  • 1
    \$\begingroup\$ Your switch is a 0Ω pullup... \$\endgroup\$ – rdtsc Aug 8 '19 at 19:23
  • \$\begingroup\$ If you have a switch to ground you use pull-up resistor. If your switch is to Vcc then you use a pull down resistor. In TTL technology Pull-ups were the norm because the inputs needed more current to pull down than up and using a switch to pull down was more reliable than the other way. With CMOS inputs the pull up or down are very similar. Turn on issues may dictate witch way you bias the idle state. \$\endgroup\$ – KalleMP Aug 9 '19 at 5:56

Best practice would be to have a pullup resistor on the '165 input pin, and let the relay connect the input pin to Gnd when closed. That way there is no chance of shorting the power supply to Gnd when the relay is energized.

Each pin needs its own resistor. HC165 has very little current load, 10K would be sufficient (it's what I use for pullup resistors).

  • \$\begingroup\$ with a pullup you could never get a low input, could you, or am I missing something? \$\endgroup\$ – Marcus Müller Aug 8 '19 at 15:58
  • \$\begingroup\$ One relay contact goes to Gnd, the other to the input pin. The resistor goes between V1 +5 and the pin. \$\endgroup\$ – CrossRoads Aug 8 '19 at 16:00
  • \$\begingroup\$ Ah, ok, sorry, I was confused by the mismatch of your description and OP's circuit. \$\endgroup\$ – Marcus Müller Aug 8 '19 at 16:01
  • 1
    \$\begingroup\$ That would invert the indicator level, which may have consequences for whatever is downstream of the information flow. \$\endgroup\$ – Oldfart Aug 8 '19 at 16:01
  • 1
    \$\begingroup\$ @Oldfart, you could also switch from NO to NC relay. \$\endgroup\$ – The Photon Aug 8 '19 at 16:03

Per the datasheet, all unused inputs require being pulled up to Vcc or pulled down to GND (it's a CMOS device). Using a 100K-Ohm. You want to pull the voltage level, not blow through a lot of current. For any other signal a pull-up or pull-down is only used to ensure a pin is at a given state, when not being influenced by another signal (other than noise). It's purpose is to be strong enough to overcome noise, but not so strong it overrides a valid signal. A valid signal should always override the pull-up/down as necessary.

And that is how you calculate the size of your pull-up/down resistors. Not just a random 'Gee, someone said a 10K or a 4.7K'. I'm only mentioning that because noobs rarely get told how to choose a component, and that is part of the engineering process.

Beyond that, the only reason you use a resistor is to limit current. Use only what you need based on a) signal purpose, b) noise/interferences, and c) cosideration of junction temperatures. Using only what current is necessary (always in your designs) is a good habit because it allows you to do more in some cases when current limits exist. Speaking of such limits- pay attention to the maximum current allowed through your preferred shift register.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.