EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Keypad decoder

Started by Frank Valkenborgh March 19, 2003
Hi all,

Has anyone some samplecode to decode a keypad?
Or to chack a pincode?

Thanks,

Frank




In a message dated 3/19/03 3:24:31 AM Eastern Standard Time,
writes:

> Has anyone some samplecode to decode a keypad?
>
I've read a few keypads. I can describe the algorithm, but you asked for
sample code. How about telling me how many rows, how many columns, and what
pins in what ports they are hooked to? THEN you can start writing code.....


Frank --

Details vary depending on how you choose to drive and sample your keypad and
what its topology is.

For a basic crossbar style keypad driven by a direct I/O pin interface the
basic process is:

1. Drive each column in turn.

2. Sample the row outputs to see if any row-column intersection is active.
You must also check for multiple rows activated by having two buttons
depressed.

3. Don't forget to debounce the keypresses.

All of this must be done while scanning the keypad as fast as possible to
assure a rapid response time.

A standard 4 x 4 keypad will require 8 I/O ports/pins, four output pins for
column drivers and four input pins for row sampling.

I drive mine using the SPI in interrupt driven mode but it is a wee bit slow
to suit me. My clients wants to add a second control panel to his system so
I am thinking of droping a 68HC08 on the keypad/LCD panel to handle the
overhead and communicate with the system control processor via SCI or SPI.

Other methods include using a keypad decoder IC (See Nat Semi, something
like the 74HC922/3 I think???).

You can also dedicate a small MCU such as the MC68HC908QT(Y) which has built
in keypad interrupts.

The final answer is, "It depends" (mostly on what your hardware interface
looks like).

"> Or to chack a pincode?"

Is that a typo?

Happy decoding, Bob Smith
--- Avoid computer viruses, Practice safe hex ---

-- Specializing in small, cost effective
embedded control systems --

http://www.smithmachineworks.com/embedprod.html Robert L. (Bob) Smith
Smith Machine Works, Inc.
9900 Lumlay Road
Richmond, VA 23236 804/745-1065
----- Original Message -----
From: "Frank Valkenborgh" <>
To: <>
Sent: Wednesday, March 19, 2003 3:23 AM
Subject: [m68HC11] Keypad decoder > Hi all,
>
> Has anyone some samplecode to decode a keypad?
> Or to chack a pincode?
>
> Thanks,
>
> Frank > To unsubscribe from this group, send an email to: >
>
> ">http://docs.yahoo.com/info/terms/ >




Ok, you are right.

I want to use a simple 4x4 keypad. 4 rows 4 columns.
I know how to decode, but I also want to know if what I'm doing is good. ;-)

Actually it is a type mistake ..it's to check the pincode.

Thanks in advance,
and allready thanks to respond to my question.

Frank
----- Original Message -----
From:
To:
Sent: Wednesday, March 19, 2003 1:02 PM
Subject: Re: [m68HC11] Keypad decoder In a message dated 3/19/03 3:24:31 AM Eastern Standard Time,
writes:

> Has anyone some samplecode to decode a keypad?
>
I've read a few keypads. I can describe the algorithm, but you asked for
sample code. How about telling me how many rows, how many columns, and what
pins in what ports they are hooked to? THEN you can start writing code.....
To unsubscribe from this group, send an email to:

">http://docs.yahoo.com/info/terms/



Memfault Beyond the Launch