this is sample program by using 8051. i hope it help you
- - - Updated - - -
also show this websites
http://www.engineersgarage.com/embedded/avr-microcontroller-projects/interfacing-keypad-circuit
http://extremeelectronics.co.in/avr-tutorials/4x3-matrix-keypad-interface-avr-tutorial/