Shop OBEX P1 Docs P2 Docs Learn Events
Memkey & Keypad — Parallax Forums

Memkey & Keypad

j1234jj1234j Posts: 2
edited 2010-05-04 23:09 in BASIC Stamp
Hey guys. I'm really having trouble with the 4x4 matrix keypad and the memkey. The memkey is supposed to make the keypad easily programmable, but this thing is giving us trouble. One major issue is that I don't know much about the terms and code used in the datasheet for the memkey. I'm a novice in the programming world and I honestly don't even know where to begin with programming the keys to output the values we want.

How do I assign a value to each key? How do I access and write on the EEPROM for the memkey. Can anyone with any experience with getting this thing working successfully please share your knowledge and maybe a simple code to help us program it.

Any help would be greatly appreciated.

Comments

  • Adrian SchneiderAdrian Schneider Posts: 92
    edited 2010-05-04 08:41
    Did you try the application on page 11 of www.parallax.com/Portals/0/Downloads/docs/prod/datast/memkey.pdf in the Applications section? Did that work? There is even a picture of how to connect the hardware. I would start from that example and then use the information in the data sheet to find out what is going on on all those SEROUT statements.

    Regards
    Adrian
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-05-04 17:35
    You don't need to write any values to the MemKey to start using it. By default it outputs ASCII values for a particular keypad layout. If you'rs doesn't match it is a simple matter to translate those key values into some that do match as shown below. This is a small subroutine from a security application I wrote. It takes the incoming value and translates it into the desired value for a given key code.
    KeyScan2:
      LOOKDOWN inKey, [noparse][[/noparse]84, 83, 82, 81, 79, 78, 77, 76, 74, 73, 72, 71, 69, 68, 67, 66], inKey
      LOOKUP inKey, [noparse][[/noparse]49, 50, 51, 65, 52, 53, 54, 66, 55, 56, 57, 67, 42, 48, 35, 68], outKey
      RETURN
    ' This LOOKUP command translates to the ASCII values for the following
    ' keypad layout.  You can change these to match your keypad, or to return
    ' different values for the same keys.
    '
    ' 1  2  3  A
    ' 4  5  6  B
    ' 7  8  9  C
    ' *  0  #  D
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • j1234jj1234j Posts: 2
    edited 2010-05-04 20:48
    We have the keypad and memkey set up and ran the program from page 11 of the data sheet but the values given for the key pressed don't make any sense. For a command of $40 we get back a value of 64. I don't know how this value is returned. I don't know what language the code uses. I don't even really know what $ signifies. All I want to be able to do is program this thing with the values we want. So far I have no idea how $40 give you 64. I have looked at that data sheet over and over and have yet to gain any insight beyond being able to change each key value to some random number based on a value changed in place of $40.
  • hover1hover1 Posts: 1,929
    edited 2010-05-04 23:09
    The $·denotes a hex number http://en.wikipedia.org/wiki/Hexadecimal.

    A $40 in hexidecimal is equal to 64 decimal.

    Reference page 96 in the Basic Stamp Manual Ver 2.2.

    Jim


    j1234j said...
    We have the keypad and memkey set up and ran the program from page 11 of the data sheet but the values given for the key pressed don't make any sense. For a command of $40 we get back a value of 64. I don't know how this value is returned. I don't know what language the code uses. I don't even really know what $ signifies. All I want to be able to do is program this thing with the values we want. So far I have no idea how $40 give you 64. I have looked at that data sheet over and over and have yet to gain any insight beyond being able to change each key value to some random number based on a value changed in place of $40.
Sign In or Register to comment.