Ok maybe i''m going about this all wrong but here's my issue.
I have a 12 button keypad where the outputs are in an array. I'm trying to sense each individual button by hooking up a series of resistors and reading the voltage on an analog in (pic18f4550). The problem i'm running into is that the +5v varies and this affects the final out voltage.
is there a way to sense the input voltage with out using another analog pin? i'm using all the remaining pins for data logging.
The normal way to read a grid keyboard (at least when I was young) was to input a sequense on the row where one bit is always high.
Then reading the coloumn and compare it (in time) with the active bit position on the row.
The problem i'm running into is that the +5v varies and this affects the final out voltage. Is there a way to sense the input voltage with out using another analog pin? i'm using all the remaining pins for data logging.
I basically used a combo of the scan and resistor technique. I don't need to sense multiple keys so it's not an issue. My Grid was 3 x 4, so i have three DO's that i scan, and sense the single input of resistors to an A/D pin. I can space the resistor values far enough apart to eliminate the "error" problem i was encountering earlier. It's been working well. I can post schematic or code if anyone is interested.
Thanks, but I've read the pdf and technique is clear to mee. What is a little unclear yet is how to make the resistor grid make correct output and some hints about it.
I mean - having just a bounch of R/2R resistor ladder with push buttons is easy enough. But by having a grid, you must have a system to ensure that two buttons doesn't output same voltage. That's the hard part to get.
You use binary values, 64k, 32k, 16k, 8k on rows and 4k, 2k, 1k, 500R on columns with 500R to ground. You end up with 16 voltages that are easily discernible.
Thanks Atom, yeah there were lots of tricks from the old days of using RC time testing to get a crude ADC value. Most of the early PICs did not have ADC modules back then, until the 16C71 I think and even then the ADC pics were expensive.
People did cool tricks like comparing the RC time difference of a ST input against a TTL input, to test the 5v or battery voltage. Or testing the WDT timeout to get a temperature value as it changes with temp more than the xtal does.