Nigel Goodwin said:I've never actually done it, but I've seen it done a lot over the years.
The technique is very simple, you feed +5V through a resistor to the A2D input, so it now reads 5V - no button pressed. You then have a series chain of resistors from this point, with switches down to ground. So when you press a switch it creates a potential divider with the upper feed resistor. By carefully selecting the resistor values you can find which key was pressed by measuring the voltage.
It's usual to have one key which shorts directly to ground, so that key would read 0V, no key 5V, and all others somewhere inbetween.
How many buttons are you wanting?.
rrb011270 said:I am planning to have a 3x4 keypad on this project? can you help me on this? any information will do?
Exo said:Where are you going to connect the pic's input to ?
rrb011270 said:Exo said:Where are you going to connect the pic's input to ?
I am planning to connect my keypad output to AN0 ---> an analog input for the PIC.
I guess this URL --> https://www.reed-electronics.com/ednmag/article/CA56657?text=vitor+amorim&stt=000 will give an insight that it is possible to design a keypad matrix that only use one analog port to the PIC microcontroller.
Thanx for your reply and input.
Exo said:Scanning keys using resistors an an ADC is common practive (philips even does so in some televisions) but, as you can see on the url you gave yourself, the resistors have to be placed between the switches. These 4 x 4 keypads you want to use are internally already pre-wired (in a matrix shape) wich prevents you from connecting those resistors. If you got a keypad wich allows you to connect every switch independently then there should be no problem.