Make the Keypad's ROW pins connected to PIC as Output , and column pin as Input using TRIS Register
Then using PORT register give a LOW Logic to Rows Pins and HIGH Logic to Columns pins in the main Function
Now use either LCD or Serial Terminal To view the Keypad Out Put and Initialize the same whatever you are using ,
then in While(1)
functions assign a
Code:
(unsigned char Read_keypad ; ) and make it equal to PORT register like
Suppose you have assigned PORTB pins for keypad interfacing then
HTML:
Read_keypad = PORTB ;
now apply a if condition
(
Code:
if(Read_keypad != High for the column + Low for the Rows
It checks for the row like 1st, 2nd , 3rd and 4th
)
Checking for the Row
1. Make the the particular Row pins as LOW and rest of the pin as HIGH
and now in 1st row suppose there are three keys 1 , 2 and 3
apply logic
Now In the same way Check for all Rows means Four checking and for each row there are three checking for Column Pins
This Variable will always read the key presses