Al .... it's sort of working :-) YAY at least some light at last :-)

I tried your code snippet :-) and it sort of works :-)

You can now enter digits, each keypress shows up on the LCD , a # value denotes a send and a * denotes a clear and retry.

Ok so when I enter 123# , the correct number is sent to the PC com port and arrives perfectly at MCS serial tool window! YAY
In fact any 3 digit number within the range of 100 to 255 works well.
Anything larger is obviously too large for the var byte value so shows up as the number less 256 which means it is behaving correctly since I only want a max of one byte (0 to 255).
For example I enter 455# ,MCS serial tool shows the number as 199 (455-256) .

So the problem now is how to get numbers which are less than 3 digits to work.
For example if I enter the number 99 I get 227 in MCS serial tool
Another example is the number 1 (single digit) shows up as 195

I am trying to figure out why but can't see it as yet.

Another thing is if you do send a number larger that 255 or something less than 3 digits , the next few times , any valid 3 digit number entered is incorrectly displayed ...still looking to slove that one!
I added a retry: label .. which runs when you enter the * key. It clears the vars send pointer to beginning of the main loop :-)


If you have any updates or suggestions I would gladly try them

Please find the current (semi-working) code attached below

Kind regards

Dennis
Code:
myvar var byte 'var output from keypress
Array var Byte [3] 'array variable to hold 3 keypresses
A0 var byte 'counter/index
B0 var Byte 'sum of digits
KeyPress Var Byte 'holds each keypress as it happens
           Pause 2000       ' Wait for LCD to startup

  
   A0=0   'index = 0

Ini:

lcdout $fe,1
lcdout "enter number"
@ READKEYPAD _myvar  'read keypress variable and place in myvar
  
  LOOKUP myvar,[0,"123A456B789C*0#D"],myvar 'use lookup table to diplay proper keypress
  keypress = myvar 'pass the variable to solve strange character problem
 ' will contain the ascii character of the key pressed
  
  lcdout keypress
  pause 1000
  lcdout $fe,1  
'If keypress = "a" or "b" or "c" or "d" then goto numbers
if keypress = "*" then goto retry
If KeyPress = "#" then    'check input keypress for a # value
B0= (Array[0]*100)+(Array[1]*10)+Array[2]'multiply each bit in the array by the correct column value
'if B0 > 255 then goto overflow 'test for overflow B0>255
HSEROUT ["here is the total ",dec B0,$0d,$0a]  'send result to pc com port 
 
A0=0
 
ENDIF

If A0>2 then retry 'Ini

Array[A0]=KeyPress -48
A0=A0+1

goto ini

numbers: 'tell person to enter only numbers
lcdout "numbers only"
pause 1000
A0=0
myvar=0
goto ini

retry: 'is the * key is pressed then prompt for a retry and clear A0 and myvar
lcdout "retry"
pause 1000
lcdout $fe,1
A0=0
myvar=0
goto ini

overflow: 'tell person to enter 0 to 255 only
lcdout $fe,1
lcdout "0 to 255 ONLY!"
pause 1000
A0=0
myvar=0

goto ini