mcs51mc said:About the software, this is how I should do it, but since you're not me you can still do what you want
1) Use right aligned PIC data and the full 10 bits (range 0 to 1024)
2) Average successive 256 ADC readings to get 1 avgKeyValue. That is easily done by adding all ADC readings into one 24 bit variable and use only the upper 16 bits of the result. (256 readings of 1024 will result in 262144 = 040000; upper 16 bits are 0400 = 1024). I'm sure you can find math stuff on Nigel's site
3) Set the sampling rate of the PIC in such way that you get a avgKeyValue calculation every 0.1sec.
4) Compare succesive avgKeyValue to check if a key is pressed. If yes decode the new avgKeyValue using formula, look-up table, comparing... ... (correct choice can only be made once you know the final hardware = value for every key).
5) Wait for the "no key" code to seperate successive keys.
Some good points there that I will definitely look at. I have it working pretty well as of 11pm last night... button presses are quick and accurate so far, but can only improve with some of your suggestions above.
I have no problem entering a 4 digit code (pretty much as fast as my fingers can move), and running a "lock open" routine from there. I implemented a "4 wrong tries" lockout penalty last night, so it will lock you out if you try 4 bad combinations in a row. They are reset on a good comb entry. I've also got "manager mode" figured out with a hold down of the last digit of a valid comb -- hold for 5 seconds, you get a double beep and the LED comes on and stays on. From there, I will implement "function" buttons (ie. press "0" to change combination, press "1" to add a user, press "2" to suspend a user, press "3" to delete a user, etc.).
I'll take some pics today of the keypad and lock boards -- and maybe a couple of my setup.