On Fri, 29 Mar 2019 07:56:05 -0700 (PDT), Vaibhav Kumar
declaimed the following:
>Suppose if we want to take inputs from buttons, is there any source that
demonstrates the same using shift registers ?
First... how many buttons at a time can be pressed. If you are trying
to produce some form of keyboard with only one button at a time, you do NOT
need "hundreds of inputs". You need a matrix of outputs and inputs (8
outputs and 8 inputs handle 64 buttons). You set one of the outputs, then
scan the inputs to see if a button is down.
http://blog.komar.be/how-to-make-a-keyboard-the-matrix/
Typically these suffice until you get to maybe 3 buttons pressed at
once -- if two buttons are on the same row and two are on the same column,
you get a phantom button press for the other row/column intersection.
I suppose you could use a serial-in/parallel out shift register to send
one bit to the 8 output lines, in sequence... and maybe a
parallel-in/serial-out to read the 8 sense lines... but you still need
separate clock lines for the two, output and input GPIOs, and a parallel
enable (at least, I'd add a reset line) -- so 5 (6) GPIOs and a lot of
looping to scan 64 buttons.
Toggle reset
Set output GPIO High (or low depending on logic states for matrix and SIPO)
Toggle SIPO clock
Clear output GPIO so only the one bit is in the register
Loop 8 times
Set parallel enable of PISO chip
Toggle PISO clock
Clear parallel enable of PISO chip
loop 8 times
Read serial from PISO chip
If active, button pressed
Toggle clock (next column of buttons)
Toggle SIPO clock (next row of buttons)
read PISO output for first scan
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|