SCEA117 July 2022 SN74HCS164 , SN74HCS164-Q1 , SN74HCS165 , SN74HCS165-Q1 , SN74HCS595 , SN74HCS595-Q1
For this example design, we will be driving 576 total indicator LEDs only using three GPIO pins from our selected MCU. We will also be reading in eight digital values from a set of DIP switches using only one additional GPIO pin.
This design is intentionally overly complex in order to show how to handle the “worst case” for driving multiple shift registers. In the majority of systems, none of the complexity shown here will be required, however all of the issues that are solved below should be considered.
For any system, the first step is to define the requirements.
Based on the system requirements, it would be very difficult and costly to get a single controller that could individually handle all the required LEDs (96 per board, 576 total), not to mention the large number of wires that would be required to connect them. Instead, we will be using shift registers to reduce the required number of GPIOs and signal wires to only five.
The SN74HCS595 is used to allow for the LEDs to change simultaneously. This capability does require an extra control signal (RCLK), however it is very beneficial for LED applications since flickering can be observed while loading simpler shift registers like the SN74HCS164, which do not include output storage registers.
For the controller board, the DIP switch states will be read by a parallel-in, serial-out shift register. Each switch is debounced using a simple RC circuit and the SN74HCS165 is used to support the slow input transition times caused by the debounce circuits. See Debounce a Switch for more details regarding debounce circuits.