Can output shift registers (74HC595) and input shift registers (CD4021B) share the same clock and data lines on Arduino using SPI, with different latch pins "activating" either chain for input or output shifting?
I think this should work, but don't yet have all the parts I need to prototype it. I already have all that parts for an solution that does NOT work, and am trying to skip that "opps, this won't work" step. :-)
I am currently using SPI from an Arduino Pro Micro (5v) to drive a chain of 74HC595 shift registers for a multiplexed bank of 7 segment display boards. Each "Display Board" has two 74HC595's to drive a set of displays, and is connected via ribbon cable to the next (identical) board, which is the next display in a series of chained display boards. This is built and working great. I use a loop of the following to write out data to the 74HC595 shift registers.
SPI.transfer(myByteOut);
I would like to add an IR sensor (Vishay TSOP75356WTR) to each board. The Arduino would be able to detect if the IR sensor on each chained board is high or low.
My plan is to expand the existing display board setup by adding a parallel chain of input shift registers (CD4021B?) to shift back to the Arduino the IR sensor readings from each board. This would be done via a loop of
myByteIn = SPI.transfer(0);
Can one chain of 74HC595's, and one chain of CD4021B's share the same data and clock lines, using different "latch" pins to toggle between my input (CD4021B) reading and my output (74HC595) writing?
High speed is required, and Arduino only has one hardware based high speed pair, so I'd need to share the clock and data pins. Will that work? Anything else wrong with my plan?