2
\$\begingroup\$

I'm using a microcontroller to clock a byte into a 74HC595 shift register and latch it. It then sends a signal to the other device which send 8 clock pulses when it is ready to receive the byte.

So my question is can the two devices share the one shift register clock pin? Should they be insulated from each other?

\$\endgroup\$
6
  • 3
    \$\begingroup\$ One way is to connect both clock signals via an OR gate. \$\endgroup\$
    – user16324
    Jan 25, 2015 at 22:18
  • \$\begingroup\$ @BrianDrummond Isn't an OR gate just two diodes forming a junction? \$\endgroup\$
    – blarg
    Jan 26, 2015 at 11:32
  • \$\begingroup\$ Two diodes and a pulldown resistor is one way to make an OR gate, yes. Not the best way for fast signals but OK for a microcontroller. \$\endgroup\$
    – user16324
    Jan 26, 2015 at 11:48
  • \$\begingroup\$ Would this be suitable for signals with a period of 80μs? What is different from a 4071 AND gate IC and the method you describe above? \$\endgroup\$
    – blarg
    Jan 26, 2015 at 12:30
  • \$\begingroup\$ (a) yes, (b) any basic text on boolean logic will explain the difference between AND and OR. \$\endgroup\$
    – user16324
    Jan 26, 2015 at 15:55

1 Answer 1

1
\$\begingroup\$

If both of your microcontrollers support setting the pins you are using as the serial clock signal to a high impedance state/tristate (if you are using a normal GPIO pin most micros would support this) then you can achieve what you have described without any additional components or insulating the clock pins from each other. What you will be doing is just directly wiring the two micro clock pins and the shift register's clock input together, then setting each micro's serial clock pin to high impedance whenever it is not actively generating a clock signal, leaving the other micro free to drive the clock line. There is an older question covers what it means to set a pin to high impedance/tristate a pin.

As you've picked up on with asking about 'insulating' the clock lines from each other, you want to tristate the pins so that there is not 'contention' when one micro is trying to drive the clock signal line in one direction (eg. high) and the other micro is trying to drive it in another direction (eg. low) - which would cause the two micros to source/sink a lot of current, get things hot, potentially let the magic smoke escape and generally cause trouble. As a result you should be careful that there is never any time when both micros are actively driving (ie. not high impedance) the clock line at the same time, particularly during the hand-over time when you are changing which micro is driving the clock line.

You will probably also want to add a pull up resistor on the shared clock line to avoid the clock line being free to oscillate around due to any noise it picks up at times when neither micro is actively driving the line (ie. both have their clocks set to high impedance - this will probably happen, at least for a short time, if you pay attention to the previous sentence...). You may be able to get away without the pull up resistor by using the internal pull ups on the micros, or just get lucky and not pick up any 'spurious' clock signals, but it would be safer to add the external pull up.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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