Hello I have modidier the program in this manner, I do not know if it is correct mercy
'// Define port pins as inputs and outputs ...
TRISA = %00001000
TRISB = %11111111

'// Declare Variables...
Col_A VAR PORTB.6
Col_B VAR PORTB.5
Col_C VAR PORTB.4

Row_A VAR PORTB.0
Row_B VAR PORTB.1
Row_C VAR PORTB.2
Row_D VAR PORTB.3


RX_To_PC VAR PORTA.0

Scan_Col VAR BYTE ' Counter - denoting current col in scan
Key_Press VAR BYTE ' Contains value of key (0-9) & * + #
Key_Down VAR BYTE ' Flag set true when key is depressed
Allow_Key VAR BYTE ' Flag - disallow multiple keys being pressed
I VAR byte ' General working var
CROW_A VAR byte
CROW_B VAR byte
CROW_C VAR byte
CROW_D VAR byte
COROW_A VAR byte
COROW_B VAR byte
COROW_C VAR byte
COROW_D VAR byte
COLROW_A VAR byte
COLROW_B VAR byte
COLROW_C VAR byte
COLROW_D VAR byte
Scan_Keypad:

'// Scan cols
@ incf _Scan_Col, 1 ' Inc col pos...

SELECT CASE Scan_Col ' Col (1-3)

CROW_A = Col_A & Row_A
CROW_B = Col_A & Row_B
CROW_C = Col_A & Row_C
CROW_D = Col_A & Row_D

'// 1 Key
IF CROW_A = 0 THEN ' Key down? ...
IF Allow_Key = 0 THEN ' Any other key down?
Key_Press = 1 ' Load var w/value of key
Allow_Key = 1 ' Disallow other keys
ENDIF
ENDIF
'// 4 Key
IF CROW_B = 0 THEN
IF Allow_Key = 0 THEN
Key_Press = 4
Allow_Key = 1
ENDIF
ENDIF
'// 7 Key
IF CROW_C = 0 THEN
IF Allow_Key = 0 THEN
Key_Press = 7
Allow_Key = 1
ENDIF
ENDIF
'// * Key
IF CROW_D = 0 THEN
IF Allow_Key = 0 THEN
Key_Press = 42
Allow_Key = 1
ENDIF
ENDIF