BCJ, you cant use my values in your spreadsheet. If youll notice, we use different wiring configurations to achieve our keypads.
With your config, you have the resistors gang on each other as you go to higher switches(IE 1 key uses 820, 2 key goes through 820 and 910, 3 key goes through 820,910, and 1100 as well as of course the dividing resistor).
My config has voltage going through only two resistors no matter which key is pressed.
When I plugged my numbers into your SS, I saw the big spans you saw. After some investigation, I noticed the differences in the wiring.
Now, either config should work perfectly fine .
The reason I went with my config is to hopefully fend off multiple key pressings being a factor.
Ill explain:Going by the diagrma you have bottom left of your SS, lets make those 5 switches key1- key5. If you press key 2 there will be 2200 ohms in the circuit. If you press key 4, there will be 5700 ohms of resistance in the circuit. Now, if we press key 2 and key 4 we get.....2200 ohms. The code will see a key 2 press and thats all. If you meant to press 4 but accidentally caught 2 also, your screwed because your software sees 2.
With my config, Im trying to handle multiple key pressings in the circuit design stage instead of making the code handle it. Pressing two keys simaltaneously in your config keeps the series circuit of less resistance. In my config, pressing two keys creates a series-parallel circuit. This series-parallel combo should yield a voltage different than assigned voltages for any single key. My code right now shows a range of 15 for each key. Some preliminary testing tells me I should be able to keep a roundabout 15 span between each key but make the key range itself 3.
Example
if b0>=9 and b0<=11 then b1=1
if b0>=24 and b0<=26 then b1=2
if b0>=41 and b0<=43 then b1=3
Hitting keys 1 and 2 would generate an ADC value of 33.558. The code would see this as nothing and move on.
If Im correct with my calcs I should be able to arrange the code this way. My hope is that multiple key pressings will generate voltages outside of these ranges thereby handling multiple pressings without code. im sure some combos of keys will fall into a valid range, but the resistances used could be adjusted slightly to move them to an invalid range them.
Im sure were a ways away from this thing being fully functional, but this kind of input and dialog is what will bring it to fruition. Thanks for the input and ideas, keep 'em coming. Who could use six xtra IO?
Edited by - Jon Henry on 04/08/2007 22:36:54
Edited by - Jon Henry on 04/08/2007 22:38:52