How to increase the number of inputs on a microcontroller
In this video, Texas Instruments will look at how to use a shift register to expand the input capacity of your microcontroller.
A commonly encountered problem when working with the microcontroller is not having enough GPIO pins to read in multiple sensors. Upgrading to a larger MCU is not the only solution.
Parallel-input serial-output shift register can be used to read in the same number of inputs with fewer GPIO pins on the microcontroller. This is commonly known as GPIO expansion.
The parallel-input serial-output shift register operates with eight internal registers. The initial state of these registers is unknown.
However, once the shift or load pin is driven low, the inputs load into the internal registers.
After the shifter load pin returns to a high, the inputs no longer impact the value stored in the registers.
Now, on every rising edge of the clock, data from the serial pin pushes into the internal registers as the data stored in the registers shifts down and out through the serial-output.
The last register is directly connected to the output. So you get the data stored serially on every rising edge of the clock. Most shift registers have eight inputs.
So to get more than eight inputs, multiple shift registers can be connected in a chain by directly tying the output to the serial pin of the next shift register in the series while still using the same number of GPIO pins of the microcontroller.
For more information, watch the video below.