0
\$\begingroup\$

I have a small circuit, and use a shift register (74HC595) to help add output ports to drive an LCD display.

As far as I have found, the latch pin can be connected to any digital pin, and I have it connected to pin 10.

The other 2 input pins, however, require connections to the Arduino on pin 11 and 13, and as far as I am aware these can't be changed. If this assumption is incorrect please let me know.

Now I also wish to connect an SD card reader to the Arduino, and this requires a connection on pin 11 (MOSI) and pin 13 (SCK).

I have tried connecting it to the same track as the shift register on the breadboard and it all seems to work.

I was just wondering if this is bad practice or if anything could go wrong. Also, as the MOSI and SCK pins can't be changed, is it possible to move the shift register pins or not? I'm guessing NO as presumably they rely on the internal hardware too, but I would appreciate some clarification.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The MOSI and SCK pins are part of a SPI interface and are meant to be shared with multiple devices, as long as each device has a unique chip select (CS). \$\endgroup\$
    – tcrosley
    Feb 2, 2017 at 3:12
  • \$\begingroup\$ Perfect, that's just what I was looking for. Thanks. \$\endgroup\$
    – Adam
    Feb 2, 2017 at 18:28

1 Answer 1

0
\$\begingroup\$

To use a shift register with the internal SPI hardware, you have to use MOSI and SCK. However, you can also "bit-bang" the SPI on any of the pins. Indeed, the shiftOut() and shiftIn() functions use bit-banging.

\$\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.