MemKey
Using a MemKey with a 4x5 keypad. This keypad has a·few extra buttons that I have no use for such as "ABC", right, left, up and down arrows. As expected, each key returns a value, however, is there a way to write a key out so it is not functional? I have read NV59,·60,·S3 documentation, searched the forum and Google·but am unable to locate a solution. I hate to think that I am stuck adding a bunch of lines stating "IF key = X then"
I know it would be easier to find another keypad but the company I work for already stocks it making replacements easy to obtain. While it is not that big of an issue, the occasional bump of an unneeded key can be frustrating.
I did program the extra keys to return $00 but that gives a back hash each time one is pressed. I could combine that with one "IF key =·$00 THEN" statement and loop it back to·ignore the key·but I would rather disable if possible.
Thanks in advance!
·
I know it would be easier to find another keypad but the company I work for already stocks it making replacements easy to obtain. While it is not that big of an issue, the occasional bump of an unneeded key can be frustrating.
I did program the extra keys to return $00 but that gives a back hash each time one is pressed. I could combine that with one "IF key =·$00 THEN" statement and loop it back to·ignore the key·but I would rather disable if possible.
Thanks in advance!
·
Comments
·· Why can't you just ignore the extra keypress data in your program?· That would be easiest.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
That was the idea with the "IF key =·$00 THEN" statement. I will probably go that route. Just didn't want to overlook the obvious. Thanks for your help.
·· What I meant was, you can act on the key values you are looking for, and don't even check for invalid keys.· You don't need to.· If you have a loop testing for values and you have conditionals dealing with those values then you can just not test for values you don't want.· Ignore them.· Don't write any code for them.· Your code will only deal with what you're expecting...I hope I am a little mroe clear...It's late...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I have read your post about a dozen times now "you can act on the key values you are looking for, and don't even check for invalid keys" I do not see a way with my current code structure to accomplish this. I should say that I am allowing the user to enter a random 5 digit number that will display in real time as it is entered. With that being said, I just added a lookdown table that, when valid, sends the sequence back to the last keystroke just before the SEROUT command to the LCD. While I found two ways of handling this issue I am sure there are others. Being my first MemKey, my program is a little rough but it will get better as I lean more.
For the MemKey having its 7th birthday I was really suprised at how little documentation and coding examples· were kicking around.
Once again, thanks, I think I have it nailed down and working well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
The requirements were that the operator would see the 5 digit entry in realtime. The ability to verify the entry or delete it. The initial 5 X's were to show the operator it needed 5 digits and they disappear as the number is entered. At any entry step, the operator can only press keys related to that specific operation.
The requirements for the·2 digit·number are the same.
While the program is working fine, I will need to add a real time clock. As you can see there is not near enough room left for this. I could accept the default key press returns and free up some space.
Some of the problems I have run into are: If I collect a set of 5 keypresses then pull the buffer, I couldn't find a way to display each key press in realtime on the LCD. Also if I setup a single keyfind as a GOSUB then I was never able to retain a complete 5 digit variable as it would only retun the last key press
Bottom line is, there should only be one keyfind and that should be a GOSUB, the returns from each access need to be stored and displayed in realtime creating only one variable. Anyone have a good idea?
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Second, you have basically 2 types of keyfinds, you should create a subroutine for each using a variable inside it (like i since its always best to reuse temporary variables when possible) to distinguish the seperate calls (like you would declare keyval as an array, then use the index i as a pointer into that array for where to store the value, and when you do a SEROUT to the LCD you would send SEROUT 2,396,[noparse][[/noparse]182+i,keyval(i)]
Then in your main execution you would use FOR...NEXT loops to set i to the appropriate value then call the subroutine.
Following these techniques, you should be able to boil you program down to roughly 1/10th the current size, and any modifications that need to be made can be done once instead of in every keypress.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10