Shop OBEX P1 Docs P2 Docs Learn Events
keypad reader doesnt work :[ — Parallax Forums

keypad reader doesnt work :[

ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
edited 2013-04-20 11:38 in Propeller 1
i am trying to run the 4x4 keypad demo but i cannot get it to work. i have the keypad hooked up correctly but all i get from the serial terminal is
00000


     0000
     0000
     0000
     0000






     0000000000000000

this is the code for the demo
{{ 4x4 Keypad Reader PST.spin
Returns the entire 4x4 keypad matrix into a single WORD variable indicating which buttons are pressed. }}


CON


  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000


OBJ
  text : "Parallax Serial Terminal"
  KP   : "4x4 Keypad Reader"


VAR
  word  keypad


PUB start
  ' Start PST
  text.start(115200)
  text.str(string(13,"4x4 Keypad Demo..."))
  text.position(1, 7)
  text.str(string(13,"RAW keypad value 'word'"))
  
  text.position(1, 13)
  text.str(string(13,"Note: Try pressing multiple keys"))


  repeat
    keypad := KP.ReadKeyPad     '<-- One line command to read the 4x4 keypad
    text.position(5, 2)
    text.bin(keypad>>0, 4)      'Display 1st ROW
    text.position(5, 3)
    text.bin(keypad>>4, 4)      'Display 2nd ROW
    text.position(5, 4)
    text.bin(keypad>>8, 4)      'Display 3rd ROW
    text.position(5, 5)
    text.bin(keypad>>12, 4)     'Display 4th ROW
    text.position(5, 9)
    text.bin(keypad, 16)        'Display RAW keypad value

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-18 18:57
    There's nothing wrong with your program that I can see and there's nothing wrong with "4x4 Keypad Reader". I suspect there's something wrong about how the keypad is wired up despite your checking.
  • lardomlardom Posts: 1,659
    edited 2013-04-19 10:39
    It's been 2 years since I worked on a keypad but I had to use 10K resistors as pull-downs or pull-ups, I forget which. Your problem may not be circuit related but it might help if you posted your circuit.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-04-19 12:46
    This is the object which uses the capacitance of the pins right? I bet your wires are too long. I added 0.1uf capacitors to either the columns or the rows (I don't recall which) and it fixed the problem I was having. I know another forum member was also able to get their keypad to work after adding some capacitors.

    You could also use resistors as Larry suggests but I'm not sure if you can use the same object.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-20 11:38
    If this is the "4x4 Matrix Membrane Keypad" you will need pullup or pulldown resistors on the 4 leads that are used as inputs.
Sign In or Register to comment.