Shop OBEX P1 Docs P2 Docs Learn Events
Parallax 4X4 matrix keypad — Parallax Forums

Parallax 4X4 matrix keypad

ArchiverArchiver Posts: 46,084
edited 2004-06-18 20:18 in General Discussion
In a message dated 6/17/2004 2:59:06 PM Eastern Daylight Time,
CHRIS@R... writes:


> Has anyone used the Parallax (actually Grayhill) 4X4 matrix keypad.
> If so, can you tell me how many pins I would need to interface it to
> the BS2? Are there any sample programs out there? Is there a
> different kind of keypad that only uses one wire for communication
> instead of a bunch like this one may use?
>

Depends on what you want the matrix to do. Just to light LEDs it would take
8 I/O lines. For something heavier duty you might want to use a 595 shift
register or maybe a TPIC6595. Both take 3 I/O lines, I think.

Sid


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-06-17 19:19
    Hi,

    Has anyone used the Parallax (actually Grayhill) 4X4 matrix keypad.
    If so, can you tell me how many pins I would need to interface it to
    the BS2? Are there any sample programs out there? Is there a
    different kind of keypad that only uses one wire for communication
    instead of a bunch like this one may use?

    Thanks,

    Chris
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-17 21:18
    <Jon's Standard Reminder On>

    Yes, check the Nuts & Volts section of our web site.

    <Jon's Standard Reminder Off>

    There are at least a couple articles on keypad scanning.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: christopher41877 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=kIVm8o8PwWcfTdU1rEUgCHQiKFbQtPBxUF23t4LGvLGuVs84rBJ4w4yqdZwSrPArJUlP1pyuVXu2ucIKJz4Iniy0Wt5D-Qc]CHRIS@R...[/url
    Sent: Thursday, June 17, 2004 1:19 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Parallax 4X4 matrix keypad


    Hi,

    Has anyone used the Parallax (actually Grayhill) 4X4 matrix keypad.
    If so, can you tell me how many pins I would need to interface it to
    the BS2? Are there any sample programs out there? Is there a
    different kind of keypad that only uses one wire for communication
    instead of a bunch like this one may use?

    Thanks,

    Chris



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.

    Yahoo! Groups Links







    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-18 01:05
    Chris,

    I have a same question before. You can use MM74C922 as keypad encoder.
    You can go to
    http://www.geocities.com/SiliconValley/Orchard/6633/projects.html
    for the code and schematic.
    It is good, cheap and very easy solutions. The only drawback is that it will
    take 5 I/O pins (comparing with RS232 keypad encoder that uses less pins).

    Regards,
    Bronson Alex


    Original Message
    From: "christopher41877" <CHRIS@R...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, June 18, 2004 1:19 AM
    Subject: [noparse][[/noparse]basicstamps] Parallax 4X4 matrix keypad


    > Hi,
    >
    > Has anyone used the Parallax (actually Grayhill) 4X4 matrix keypad.
    > If so, can you tell me how many pins I would need to interface it to
    > the BS2? Are there any sample programs out there? Is there a
    > different kind of keypad that only uses one wire for communication
    > instead of a bunch like this one may use?
    >
    > Thanks,
    >
    > Chris
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-18 16:32
    --- In basicstamps@yahoogroups.com, Newzed@a... wrote:
    > In a message dated 6/17/2004 2:59:06 PM Eastern Daylight Time,
    > CHRIS@R... writes:
    >
    >
    > > Has anyone used the Parallax (actually Grayhill) 4X4 matrix
    keypad.
    > > If so, can you tell me how many pins I would need to interface it
    to
    > > the BS2? Are there any sample programs out there? Is there a
    > > different kind of keypad that only uses one wire for
    communication
    > > instead of a bunch like this one may use?
    > >
    >
    > Depends on what you want the matrix to do. Just to light LEDs it
    would take
    > 8 I/O lines. For something heavier duty you might want to use a
    595 shift
    > register or maybe a TPIC6595. Both take 3 I/O lines, I think.
    >
    > Sid

    Keypad = input = 74HC165 and 3 lines
    2 units would handle 16 inputs (4 x 4=16 butttons on the keypad) so
    a pair of 165's *could* handle a 4x4 keypad. I don't have the code
    and have not tried to use these, but I just wanted to review the
    possibility.

    Dave
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-18 20:18
    Chris,

    I used 5 BS2 pins to control '595 and '165 shift registers.
    I only used 4 output and 4 input, so I still have 4 output and 4
    inputs left over. Typically, this would have taken 8 pins (4 output
    and 4 input) if done in classical textbook approach.

    Below is the code I used.

    '{$STAMP BS2}
    '{$PBASIC 2.0}

    CLK CON 0 'pin 11 of 595, pin 2 of 165 orange
    D595 CON 1 'pin 14 of 595 purple
    CS595 CON 2 'pin 12 of 595 brown
    D165 CON 3 'pin 9 of 165 grey
    CS165 CON 4 'pin 1 of 165 white/red

    db VAR Bit
    press VAR Bit
    press = 0

    key VAR Nib
    keys VAR Byte

    Row VAR Nib
    Col VAR Nib

    pattern VAR Byte
    switches VAR Byte

    LOW CS595
    HIGH CS165

    Again:
    pattern = %00000001
    GOSUB Keyscan
    IF press = 0 THEN Again
    DEBUG "Key pressed = ", DEC Keys & %00001111, CR
    press = 0
    GOTO Again

    Keyscan:
    FOR row = 0 TO 3
    SHIFTOUT D595, Clk, MSBFIRST, [noparse][[/noparse]pattern]
    PULSOUT CS595, 1

    PULSOUT CS165, 1
    SHIFTIN D165, Clk, MSBPRE, [noparse][[/noparse]col]
    key = NCD col
    IF key <> 0 THEN push

    pattern = pattern << 1

    NEXT

    db = 0
    RETURN

    Push:
    IF db = 1 THEN Done
    db = 1
    press = 1
    keys = (row*4) + (key-1)

    LOOKUP keys, [noparse][[/noparse]1,2,3,10,4,5,6,11,7,8,9,12,14,0,15,13], keys

    Done:
    RETURN

    --- In basicstamps@yahoogroups.com, "christopher41877" <CHRIS@R...>
    wrote:
    > Hi,
    >
    > Has anyone used the Parallax (actually Grayhill) 4X4 matrix
    keypad.
    > If so, can you tell me how many pins I would need to interface it
    to
    > the BS2? Are there any sample programs out there? Is there a
    > different kind of keypad that only uses one wire for communication
    > instead of a bunch like this one may use?
    >
    > Thanks,
    >
    > Chris
Sign In or Register to comment.