I don't know how you want to connect your 3x4 keypad but the way you did explain is not going to work.
See the attached schematic. You have to put portB.1 to portB.3 (one at the time) to be an output and set it to low.
If you push one key of your keypad then the interrupt will detect the change (portB.4/7 going low) and will jump in the interrupt subroutine where you will decode the key, knowing which portB.1/3 was active low and which portB.4/7 was activated.
Al.
Bookmarks