Using a PIC to decode a 23 button keypad

Thread Starter

Sophtware

Joined Oct 2, 2006
0
Hi All,

I have a small problem. I'm designing a Data Terminal that has 23 buttons that need to be decoded by my PIC MCU. The problem is that I can't use 10 I/O pins from the PIC to decode a 5x5 matrix.

I haven't nailed down what PIC I will be using, but I'd like to stick to the 28 pin variety because the cost and footprint is very important. (The smaller the better.) This size PIC will give me the USART that I need, plus 6 I/O for the LCD display, and some extra for buzzer and maybe something else.

I already know about encoders like the 74C922, but these are *way* over budget for my project. Most of these IC's are over the $10 each range. I've looked into Resistor Ladders (R2R), but with a 10-bit ADC on the PIC and 23 buttons, I don't think the resolution is enough to be 100% accurate all the time.

Someone also suggested that I use the CCP feature with a capacitor and the resistor ladder and use the PIC to time the charge on the capacitor. But I'm not sure how that would give me any more resolution than a resistor ladder in the first place.

So does anyone out there have any cool tricks that I can use to decode a 23 key keypad with less than one port of I/O pins? And keep the cost very cheap! If I have to spend more, I might as well use an 18F8xxx series PIC and just use the extra ports.

Thanks ahead of time for your help!
 

hgmjr

Joined Jan 28, 2005
9,027
How about using an 8-bit priority encoder such as a 14532. I am assuming that you have 8 bits to allocate to the 23 key keypad.

You could assign 5 of the IO pins to scan the columns and then feed the 5 rows into the 14532 encoder out of which you would get a three bit binary code that your software would then be able to decode back to which row the key was in and the column scan bit would tell you which column the key was in. That would give you all the information you would need to identify the key that was pressed.

I looked in Digi-key and the price of an MC14532 is just under a dollar.

hgmjr
 

Thread Starter

Sophtware

Joined Oct 2, 2006
0
That's a great idea. I'll have to give that one a try.

I also thought of splitting the keypad into two and using 2 ADC inputs with separate resistor ladders for each side of the keypad. That would allow me to double the resolution with just the use of an extra ADC input.

Thanks for the response!
 
Top