Tried that ... it yeilds undesirable results .. and with each keypress a different value appears in MCS serial tool window :-(
Code:
the numbers are 34113
the numbers are 13500
the numbers are 3978
the numbers are 39830
the numbers are 5134
This is probably because the number is continuously multiplied each time the program loops at each keypress ... and the word value aslo can only store two bytes (16 bits)
This is how I tried your suggestion
Code:
'end of variables
Pause 2000 ' Wait for LCD to startup
Start:
@ READKEYPAD _myvar 'read keypress variable and place in myvar
LOOKUP myvar,[0,"123A456B789C*0#D"],myvar 'use lookup table to display proper keypress
lcdout myvar
lcdout $fe,1
pause 1000
mynumber = (mynumber * 10) + myvar
lcdout "my number ", dec mynumber
hserout ["the numbers are " ,dec mynumber,$0d,$0a]
The plan is along the right lines though!
1.Check keypress to see if it's valid (0-9,A,B,C,D)
2.Store each vaild keypress eg. 1,2,3 (number is 123) <<<<<<<<<<<THIS IS WHERE I HAVE A PROBLEM
DON'T KNOW HOW TO WORK WITH THE ARRAY!
3.Check for # character which denotes a valid input
4.Take first character and (LSB) and multiply it by 1(byte 1)
5.Take next character and multiply by 10 (byte 2)
6.Take next character and multiply by 100 (byte 3)
7. Now add them up (in this example 100+20+3 = 123)
8.Check that number is valid ... <255 since it must be max one byte (8 bits)
123 is valid since it's less than 255
9.Display and send the number
Those are the steps I need to go through :-)
Hope that helps
Kind regards
Dennis
Bookmarks