128 and more input using a PIC16f628

Hi all,

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.

Any advice? Greetings

Reply to
roxlu
Loading thread data ...

something like the mcp23s17 from microchip allow to setup a switch matrix up to 256 channels and more using SPI

Reply to
mmm

roxlu a =E9crit :

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.

Thanks, Jenalee K.

Reply to
Jenalee K.

Thanx, but can this also use those push buttons? (how do you call those ?)

Reply to
roxlu

Therefore I need a analog input right? And the maximum is very limited, or not?

Reply to
roxlu

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.

Reply to
mmm

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:

Reply to
Jonathan Kirwan

--
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
Reply to
John Fields

Reply to
John Fields

--
If you were seriously I/O limited you could add an HC595 and get it
down to 4 I/O\'s. :-)
Reply to
John Fields

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.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

If you don't know that pushbuttons are switches, your question should have been asked at news:sci.electronics.basics

--
Service to my country? Been there, Done that, and I\'ve got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
Reply to
Michael A. Terrell

Reply to
roxlu

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. :-)

Have Fun! Rich

Reply to
Rich Grise

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.

Good Luck! Rich

Reply to
Rich Grise

They are momentary normally open pushbutton switches. Like I said before, this belongs in news:sci.electronics.basics

--
Service to my country? Been there, Done that, and I\'ve got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
Reply to
Michael A. Terrell

Rich Grise a =E9crit :

formatting link

Thanks, Jenalee K.

Reply to
Jenalee K.

re

ly

d,

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?

Reply to
roxlu

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.

Good Luck! Rich

Reply to
Rich Grise
[...]

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.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

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.