I'm looking for a way where I can check which of the 128 buttons are pressed. I don't want to use 'switches' but real buttons, which only make contact when the user pushes the button. I was thinking about multiplexing and parallel in -> serial out shift registers.
If you will press only one button at a time then you could use a (precision) resistor string. Every button shorts a different part of the string and you measure the resistance left. Techniques like these were used in monophonic analog music synthesizers.
like every matrix keyboard you must scan continously to check for button press events.
you should organize the buttons as a 7 x 8 matrix, configure the chip for 8 (really 7 )outputs and 8 inputs and add pull-up resistors to inputs and block diodes to the outputs
scan the keyboard lowering an output bit at time for all the ouput engaged, and check if an ( or more ) inputs go low.
surfing around you shuold be able to find sources that do this kind of things.
This kind of subject has been discussed in this group. You might want to use google groups and do a search. But to get you started, I'll quote one of my own replies to one of those threads:
--
He wants to scan 128 switches, not 56.
I\'d set it up as a 16 X 8 matrix and use use something like an
HC4514 to drive the rows/columns and something like an HC151 to read
the columns/rows.
Total µC I/O\'s = 7
Yes, have a look at the 74HC597, which are parallel input latches and serial output shift registers. They can be cascaded for as many inputs as you like.
Don't pay any attention to this person, he/she is a nut. Digital is the logical choice, pun originally unintended, but I rather like it. ;-)
You make probably an 8 x 16 matrix, like John F. said, and either use a high-pin-count processor with 8 outputs and 16 inputs, or 16 input and
8 outputs, or use a decoder and a MUX or two or so. :-)
If you scan them in firmware, you can do N-key rollover - I did exactly this with a 64-key keyboard, where each key was a simple contact closure, i.e. SPST, and I just scanned it. The "brains" was a 6502. :-)
It doesn't really matter - a switch is a switch, electrically. They come in varoious forms, and yours is SPST - Single-Pole Single-Throw.
As far as the mechanical configuration, you might be thinking of "tact" switches, which are little teeny tiny things; otherwise just "pusbutton switch, SPST" is about as close as you're going to get.
Oh, and by the way - in news:sci.electronics.design, the convention is to bottom-post.
Some people are telling me its not possible to multiplex serial out parallel in shift registers.. As I've never used these.. is this true? Or is it possible?
On Thu, 15 Jun 2006 06:08:38 -0700, roxlu wrote: ...
Well, I'm not sure what you mean by "multiplexing" shift registers. I kind of envision a matrix of buttons, say 8 rows and 16 columns. You drive the rows one at a time with something like a 74HC161 and 74HC138. (although, I hear that this is the 21st century, and someone's inventd a counter/decoder on one chip, but I don't know which part it is.) For each count, latch the state of that row of 16 switches^H^H^H^H^H^H^H^Hbuttons into two cascaded parallel-in serial-out shift registers, clock them out to whatever's using the information, then scan the next line, and so on. You might want to give each swi^H^H^Hbutton its own isolation diode as well, and pullup resistors so the row register inputs don't float.
Then, of course, you'll have to capture the 16 bits from the shift registers, or maybe use 74HC151 muxes, in which case you just count through the rows and record the count values when the '151 output goes low.
This isn't true. You can pull all the row wires low and watch for any column lines going low to detect that some key is pressed. Once you know that there is something to look for, you can then scan the row lines one at a time.
This allows a simple many input NAND to generate a "keyboard interrupt" to wake the micro up.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.