Dual shift register mux

If you are really short on free microcontroller pins, and have a lot of switches to scan, this might be a good way to go. Basically, it is very similar to the single shift register mux, except you multiplex both the rows and the columns. You can essentially get an endless number of switches into 4 microcontroller pins without using as many ICs as a shift register brigade. The setup for this is shown below.

dual shift register mux schematic

Figure 1 – Example dual shift register mux schematic.

Each column is activated by clocking out the appropriate data to the parallel-out shift register, and then the data is latched and clocked in on the parallel-in shift register. As is the case with most of the shift register methods, the data read time can take a while if you’re not using your SPI interface. You also must use external pull-up resistors, and external interrupts are not available under this configuration. So it’s not as fast as a shift register brigade, and consumes 1 more pin, but can be much cheaper for large arrays.