hi everyone,
i'm a newbie here and have a problem with the coding for my 4x4 keypad.I'm using PIC16F877A and connect my keypad to port D. What i want to do is:-
when I pressed switch '1' at keypad the character display on lcd is BUS01,
when I pressed switch '2' at keypad the character display on lcd is BUS02;
when I pressed switch '3' at keypad the character display on lcd is BUS03

I've use some keypad coding which i found from internet and it works perfectly with my keypad.The problem now, I don't know how to contunie this coding to get what i really want because i'm a new user for PIC BASIC pro. anyone kindly please help me with this coding.THanx for your help and support.
below is the code:

Define LOADER_USED 1

' Define LCD connections
define OSC 20

DEFINE LCD_DREG PORTC 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 7 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 5 'LCD enable bit
DEFINE LCD_RWREG PORTB 'LCD read/write port
DEFINE LCD_RWBIT 6 'LCD read/write bit
DEFINE LCD_BITS 8 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us

TRISC = %00000000 'Set port B as output
TRISB = %00000000 'Set port D as output
low PORTB.6 'Set the R/W bit to low

pause 1000 'wait until the LCD initializes

' Define program variables
col var byte ' Keypad column
row var byte ' Keypad row
key var byte ' Key value
Value var byte
ADCON1 = 7 ' Make PORTA and PORTE digital


Pause 100 ' Wait for LCD to start

Lcdout $fe, 1, "Key In Bus ID" ' Display sign on message

loop: Gosub getkey ' Get a key from the keypad
Lcdout $fe, 1, #key ' Display ASCII key number
Goto loop ' Do it forever

' Subroutine to get a key from keypad
getkey:
Pause 50 ' Debounce

getkeyu:
' Wait for all keys up
PORTD = 0 ' All output pins low
TRISD = $f0 ' Bottom 4 pins out, top 4 pins in
If ((PORTD >> 4) != $f) Then getkeyu ' If any keys down, loop
Pause 50 ' Debounce
getkeyp:
' Wait for keypress
For col = 0 to 3 ' 4 columns in keypad
PORTD = 0 ' All output pins low
TRISD = (dcd col) ^ $ff ' Set one column pin to output
row = PORTD >> 4 ' Read row
If row != $f Then gotkey ' If any keydown, exit
Next col

Goto getkeyp ' No keys down, go look again

gotkey: ' Change row and column to key number 1 - 16
key = (col * 4) + (ncd (row ^ $f))
Return ' Subroutine over
END