i managed to get what i wanted using the following code and your advise.
with this i can enter a number that is up to a word value.
it would need some improvements but its also simple .
Let me know what you think '************************************************* ***************
'* Name : keypad.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2004 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 9/27/04 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************

DEFINE LOADER_USED 1 ' uses a bootloader
Include "Modedefs.Bas"


Define OSC 20
clear

' Setup Hardware for uart
DEFINE HSER_BAUD 115200
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_CLROERR 1


DEFINE LCD_DREG PORTD ' Use Portd for LCD Data
DEFINE LCD_DBIT 4 ' Use Upper(4) 4 bits of Port
' PORTD-4 thru PORTD-7 connects to
' LCD DB4 thru LCD DB-7 respectively
DEFINE LCD_RSREG PORTE ' PORTE for RegisterSelect (RS) bit
DEFINE LCD_RSBIT 0 ' PORTE-0 pin for LCD's RS line
DEFINE LCD_EREG PORTE ' PORTE for Enable (E) bit
DEFINE LCD_EBIT 1 ' PORTE-1 pin for LCD's E line

DEFINE LCD_BITS 4 ' Using 4-bit bus
DEFINE LCD_LINES 2 ' Using 2 line Display
DEFINE LCD_COMMANDUS 2000 ' Command Delay (uS)
DEFINE LCD_DATAUS 50 ' Data Delay (uS)

' ** Define LCD Control Constants **

I CON 254 ' Control Byte
Clr CON 1 ' Clear the display
Line1 CON 128 ' Point to beginning of line 1
Line2 CON 192 ' Point to beginning of line 2

' Define program variables
col var byte ' Keypad column
row var byte ' Keypad row
key var byte ' Key value

bigword var word ' Calculated keypad entry
NUM VAR word[7] 'Number of digits
x VAR BYTE

' Initialise Hardware
' -------------------
ADCON1 = 7 ' Make PORTA and PORTE digital
TRISA=%00000000
TRISB=%00000000
TRISC=%10000000
OPTION_REG.7 = 0 ' Enable PORTB pullupsTRISD=%00000000



pause 1000
Low PORTE.2 ' LCD R/W low (write)

lcdout I,Clr:Pause 30
lcdout I,Line1," KEY PAD TEST "
lcdout I,Line1,"..Power UP.. !!"
pause 500


loop: bigword=0
NUM[1]=0:NUM[2]=0:NUM[3]=0:NUM[4]=0:NUM[5]=0
lcdout I,Clr:Pause 30
lcdout I,Line1, "Press any key" ' Display sign on message
gosub getword
lcdout I,Clr:Pause 30
lcdout I,Line2,#bigword

pause 1000
Goto loop




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

getkeyu:
' Wait for all keys up
PORTB = 0 ' All output pins low
TRISB = $f0 ' Bottom 4 pins out, top 4 pins in
If ((PORTB >> 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
PORTB = 0 ' All output pins low
TRISB = (dcd col) ^ $ff ' Set one column pin to output
row = PORTB >> 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
getword:
for x = 1 to 7

Gosub getkey ' Get a key from the keypad
if key = 10 then key = 0
if key = 16 then goto breakout
lcdout I,Line2+x,#key ' Display ASCII key number
NUM[x]=key
next
breakout:

if x = 2 then
bigword= NUM[1]
endif
if x = 3 then
bigword= NUM[1]*10 + (NUM[2]*1)
endif
if x = 4 then
bigword= NUM[1]*100 + (NUM[2]*10)+(NUM[3])
endif
if x = 5 then
bigword= NUM[1]*1000 + (NUM[2]*100) +(NUM[3]*10)+(NUM[4]*1)

endif
if x = 6 then
if( NUM[1]>6)or ( NUM[2]>5) then goto large
bigword= NUM[1]*10000 + (NUM[2]*1000) +(NUM[3]*100)+(NUM[4]*10)+(NUM[5])

endif
return

large :
lcdout I,Line2," Value Too Large"
pause 500
goto loop
End

















Best Regards
Toni