Shift register keypad

In order to save precious input pins, I first tried to use an analog input to read keypad values. It didn't lead to good results, as I point out in this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1256180034/12#12.

My next attempt was to use a shift register. The shift register I use is CD4021B.

I ripped the keypad from an old ericsson diavox phone http://www.ericssonhistory.com/templates/Ericsson/Article.aspx?id=2095&ArticleID=1371&CatID=360&epslanguage=EN I found from the attic. In addition to row/column pins of the standard matrix keypads, it has two other pins. I don't know what the pin no. 9 is for, but the pin no. 8 is very useful. If I connect pin 8 to +5V, the corresponding row and column pins goes high when a key is pressed. There is no need to pull rows high/low one by one and scan the column pins as the standard approach goes. To be honest, I can't figure out how to read the keypad with a shift register without the extra pin. The shift register is parallel in, AFAIK it provides no means to put pins high/low that is needed in the standard approach. Please let me know if you know how it can be done with a shift register using the row/column pins only.

I made a little adapter board where the shift register sits on. The resistors are pull-downs for the shift register's input pins.

I removed the cable from the keypad and replaced it with a male header. It matches the adapter's female header. The wires from the adapter goes to Arduino's three digital pins, +5V and GND.

I also wrote a modified version of Mark Stanley's and Alexander Brevig's Keypad library http://www.siterunner.fi/liitteet/outijapekka/materiaalipankki/8.zip. I has the same interface and event model as the Keypad library, only the constructor is different.