I needed it few hours ago and was unable to find anything "ready to use" so I made it myself.... The principle is fairly simple ... add few resistors to the keypad so you get different resistance for each key, use that resulting keypad as voltage divider (vpp to gnd) and feed the output to ADC of your uC... read the adc, decode the key pressed
Attached is schematic (small pic using adc to get the info from keypad and 2 shift's to turn on the "approprate" led). The attached code is in MikroC but it is really simple to write it in any language.
I needed it few hours ago and was unable to find anything "ready to use" so I made it myself.... The principle is fairly simple ... add few resistors to the keypad so you get different resistance for each key, use that resulting keypad as voltage divider (vpp to gnd) and feed the output to ADC of your uC... read the adc, decode the key pressed
nigel, I first spent 10min on advanced search of this forum, then another 15 on google and then 10 making the circuit as I was unable to find anything on-line (I'm sure there's ton's of it as it is - easy to make, useful...) but seams I was using wrong keywords to find it ...
pretty sure that "one more solution" will not hurt (and yes, I'm pretty sure I did not invent hot water )
Pommie, depends on what ya need.. if I'm to design a "alarm system" or something like that, I'd scan keypad (using io pins directly or port extender or ...) and would not use the adc to do it .. but for breadboarding .. I often need few switches to test "this and that" which will not be in final "product" and this is the easy way to implement this
nigel, I first spent 10min on advanced search of this forum, then another 15 on google and then 10 making the circuit as I was unable to find anything on-line (I'm sure there's ton's of it as it is - easy to make, useful...) but seams I was using wrong keywords to find it ...
Just a quick point to think about (because JVC obviously didn't), choose which button you use for what function carefully.
The JVC cable remotes commonly failed on the screened wired it connected via (as you would expect) - the result was that any button you pressed was read as 'record' and wrote over the tape you were perhaps wanting to watch
Nigel Goodwin;707156(because JVC obviously didn't)
the result was that any button you pressed was read as 'record' and wrote over the tape you were perhaps wanting to watch :D[/QUOTE said:
now that's safe
Anyhow, I would never use the AD for anything in production... maybe it is safe, maybe it is not, but there's just too much room for error... I need this for everyday testing ... insted of
a:
- undefine that
- define this
- compile
- test
goto a
I make a big switch instead of big ifdef and test different things on "press of a button" and this give's me 12 switches on one pin
wanna bet ? ... no tv, no vcr, not a single remote, wired or wireless in whole appt .... over 10 computers but only few keyboards and all very expensive ones .. there's a really small chance that some of the phones do that, but I don;t think so
the theory is straight forward ... look at the longest path, divide by number of elements in a path and that;s it ... in general for X*Y matrix, on the X side use (X-1) R and on Y side (Y-1) R*(X) .. select R to be some arbitrary value .. (I used 10K) so in this case for R = 10K 3x4 keypad uses 2 10K resistors and 3 30K resistors ... if it was 4x4 keypad for example, with R=10 you would use 3 10K resistors and 3 40K resistors ..
There might be "smarter" way to do it, and 5% tolerance might work .. but this is what first came to my mind and as I have bunch of 1% resistors I used them and keypad works perfectly (I read correct key every time ... funny results with multiple key;s dough)
Thanks Mike, the method is not new .. it's kind of "hot water" thing, but I need it for "testing purposes" .. (reducing number of switches going to breadboard ) ... and as I was unable to find any such project (and I know there is at least one on this forum, I know I saw it like a year ago...) I decided it is faster to make then to search and then added the project here with all the tag's and stuff so it can be easier to find