Arduino-based rotary encoder board, part 2.
More doodling. I’m impossibly enmired in real life at the moment, but I’ve got time to look up data sheets on my phone. Remember that the two different kinds of shift register used here are designated Serial-In Parallel-Out (SIPO) and Parallel-In Serial-Out (PISO). The SIPO register is used for bank control and the PISO registers are used for data capture from the rotary encoders.
Connections I need to make between the Arduino and the 74HC595 SIPO register:
A line to pin 14 SER. This holds the new value to be shifted into the right of the register.
A line to pin 11 SRCLK. This is the clock line and should go high long enough to complete the shift operation whenever we want to switch to the next bank of rotary encoders.
Pins that need to be tied in place.
Pin 10 (~SRCLR) must be tied high. We never want to clear the register.
Pin 12 (RCLK) must be tied to pin 11 (SRCLK) for this kind of operation. The effect is that the storage register lags one clock cycle behind the shift register, but the important thing is that it follows the shift register faithfully and feeds the parallel output pins.
Pin 13 (~OE) must be tied low. We always want the outputs to be available.
Other connections.
Pin 16 needs +5V power.
Pin 8 needs earth.
100nF capacitor across 16 and 8.
For each active bank of rotary encoders, one of the 8 output pins A-H (pins 15 and 1-7) must lead to the SH/LD of the corresponding 74HC165 PISO register(s). When this leg is low the PISO is in load mode and signals from any rotary encoder leg connected to one of its 8 parallel inputs go into the register. When it goes high the value is frozen and the PISO register goes into shift mode so it can deliver a snapshot of the encoder legs to the Arduino.
So that’s the bank control logic. This design needs two digital output pins from the Arduino.
Edit: If I switch to using SPI for bank control as well as data acquisition, I may be able to share pins between the two functions and end up using only the three SPI pins plus possibly one more digital output. It all depends on how cleverly I can design this.