Getting an input from a user may seem trivial, but in real word it will lead to resolve some problems like switch bounce, input correction, input validation, polling function in each major loop of the program, and so on...
Here is a very convenient way to solve them : this interrupt-based keypad library will do it for you.
Why another PIC Keypad LIBRARY ?
There are already tons of keypad PIC libraries on the web, but I think this one will be the most universal and versatile, featuring :
* keypad up to 8x8 or buttons up to 8
* fully configurable I/O :
o user defined ports
o in keypad mode row port and column port may be different
o user defined bits in port
o user defined rows and columns number
* user defined character lookup table
* user defined erase and enter keys
* works on interrupt : no polling necesary, no key lost
* auto debounce, delay is user defined
* switchable typematic (auto-repeat) mode at run time, rate is user defined
* switchable linear/circular buffer mode at run time
* input is available at any time in a string buffer
* maximum input size is user defined
* other functions :
o last key entered
o keypad status...
check it and download it herehttp://www.micro-examples.com/public/microex-navig/doc/083-keypad-library#2