You can follow the tutorial, Interfacing Keypad with PIC Microcontroller. I think you will be using an LCD also in this project. If so you can display a menu in the LCD. Based on the menu you can select the direction of motor rotation. You can create one menu to adjust the speed or duty cycle of the PWM. Enter the value of duty cycle (0 ~ 100%) using the keypad.