Matrix Keypad Interface

Started by jasongarbus April 14, 2003
Can someone help with this? I need to interface a 4x4 matrix keypad
to a basicx and output this as 8-bit BCD. Also is there a way to do
key mapping? At present Im using a Fairchild keypad decoder IC or
this project but the problem is it wont allow me to assign the rows
and colums to the output I would like "row 1 col 4 on the keypad is A
but the chip sees it as 4" Any help would be great

Jason



Hi Jason!

You should be able to translate the bytes sent from the keypad chip pretty
easily. Assuming the byte in a sharacter, you setup two strings, one for the
values returned by the keypad, one for the values you want. like this:

src = "0123456789ABCDEF"
dst = "5678ABCD012349EF"

Rslt = Mid(dst,Instr(src,KeyPadChar),1)

(not tested on BX24)

This assumes that the character from the keypad is in KeyPadChar, and the
result is put into Rslt.

In the example above, a "4" from the keypad would become "A", a "0" from the
keypad would become "5", and so on.

If it's returning a byte value of 4 instead of an ASCII "4", you could build
your character string like:

src = chr(0) + chr(1) + chr(2) + chr(3) + chr(4) + ... etc...

In any case, check the syntax on the BX24 first, but the idea above should
work.

Sloan ----- Original Message -----
From: "jasongarbus" <>
To: <>
Sent: Monday, April 14, 2003 7:29 PM
Subject: [BasicX] Matrix Keypad Interface > Can someone help with this? I need to interface a 4x4 matrix keypad
> to a basicx and output this as 8-bit BCD. Also is there a way to do
> key mapping? At present Im using a Fairchild keypad decoder IC or
> this project but the problem is it wont allow me to assign the rows
> and colums to the output I would like "row 1 col 4 on the keypad is A
> but the chip sees it as 4" Any help would be great
>
> Jason > ">http://docs.yahoo.com/info/terms/ >




Since your going to be interfacing with a keypad then your going to want to
see the digits as you enter them. Matrix Orbital sells a Serial LCD with a
keypad interface. The device works well and you can communicate with it via
a 232 or I2c interface. I currently have two projects that use the LCD with
an I2c interface (one with a BX24 and one with a PIC16f84). The LK162 has a
12 key interface (4 col X 3 row) and a 2 x 16 display. I uploaded code that
includes the keypad translation stuff a long time ago. I think it's listed
in the file section under "Protense code". I just checked their website and
they have some that will do 25 keys.
(www.matrixorbital.com/products/lk202-25.htm)
Let me know if you want any more details.
Harry

-----Original Message-----
From: jasongarbus [mailto:]
Sent: Monday, April 14, 2003 7:29 PM
To:
Subject: [BasicX] Matrix Keypad Interface Can someone help with this? I need to interface a 4x4 matrix keypad
to a basicx and output this as 8-bit BCD. Also is there a way to do
key mapping? At present Im using a Fairchild keypad decoder IC or
this project but the problem is it wont allow me to assign the rows
and colums to the output I would like "row 1 col 4 on the keypad is A
but the chip sees it as 4" Any help would be great

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



Aside from external 3rd party hardware like chips
and the matrix orbital (nice but expensive) you
might want to look at this:

Reading buttons and switches
http://www.basicx.com/Products/BX-24/Code_Examples/Buttons_BX24.zip

Reading a 4x4 matrix keypad
http://www.basicx.com/Products/BX-24/Code_Examples/Keypad_BX24.zip

-- Doug


If I use the I2c bus how far can I run it? The BCD was going to run
over some distance but I could modify the project. If I cant ust the
I2c bus maybe 485????not sure now.

Thanks --- In , "Harry J. White" <hwhite@d...> wrote:
> Since your going to be interfacing with a keypad then your going to
want to
> see the digits as you enter them. Matrix Orbital sells a Serial
LCD with a
> keypad interface. The device works well and you can communicate
with it via
> a 232 or I2c interface. I currently have two projects that use the
LCD with
> an I2c interface (one with a BX24 and one with a PIC16f84). The
LK162 has a
> 12 key interface (4 col X 3 row) and a 2 x 16 display. I uploaded
code that
> includes the keypad translation stuff a long time ago. I think
it's listed
> in the file section under "Protense code". I just checked their
website and
> they have some that will do 25 keys.
> (www.matrixorbital.com/products/lk202-25.htm)
> Let me know if you want any more details.
> Harry
>
> -----Original Message-----
> From: jasongarbus [mailto:jasongarbus@y...]
> Sent: Monday, April 14, 2003 7:29 PM
> To:
> Subject: [BasicX] Matrix Keypad Interface > Can someone help with this? I need to interface a 4x4 matrix keypad
> to a basicx and output this as 8-bit BCD. Also is there a way to do
> key mapping? At present Im using a Fairchild keypad decoder IC or
> this project but the problem is it wont allow me to assign the rows
> and colums to the output I would like "row 1 col 4 on the keypad is
A
> but the chip sees it as 4" Any help would be great
>
> Jason > ">http://docs.yahoo.com/info/terms/





The distance limit has a lot to do with the speed of transmission. I have
seen it successful used at 400k bits at a distance of 20 feet. I2c was
originally designed as a inter chip communications protocal and doesn't
specify twisted pair but I'm sure that it would help. 485 could be used at
long distance but then it would have to be translated at the LCD end.
Harry

-----Original Message-----
From: jasongarbus [mailto:]
Sent: Tuesday, April 15, 2003 6:19 PM
To:
Subject: [BasicX] Re: Matrix Keypad Interface If I use the I2c bus how far can I run it? The BCD was going to run
over some distance but I could modify the project. If I cant ust the
I2c bus maybe 485????not sure now.

Thanks --- In , "Harry J. White" <hwhite@d...> wrote:
> Since your going to be interfacing with a keypad then your going to
want to
> see the digits as you enter them. Matrix Orbital sells a Serial
LCD with a
> keypad interface. The device works well and you can communicate
with it via
> a 232 or I2c interface. I currently have two projects that use the
LCD with
> an I2c interface (one with a BX24 and one with a PIC16f84). The
LK162 has a
> 12 key interface (4 col X 3 row) and a 2 x 16 display. I uploaded
code that
> includes the keypad translation stuff a long time ago. I think
it's listed
> in the file section under "Protense code". I just checked their
website and
> they have some that will do 25 keys.
> (www.matrixorbital.com/products/lk202-25.htm)
> Let me know if you want any more details.
> Harry
>
> -----Original Message-----
> From: jasongarbus [mailto:jasongarbus@y...]
> Sent: Monday, April 14, 2003 7:29 PM
> To:
> Subject: [BasicX] Matrix Keypad Interface > Can someone help with this? I need to interface a 4x4 matrix keypad
> to a basicx and output this as 8-bit BCD. Also is there a way to do
> key mapping? At present Im using a Fairchild keypad decoder IC or
> this project but the problem is it wont allow me to assign the rows
> and colums to the output I would like "row 1 col 4 on the keypad is
A
> but the chip sees it as 4" Any help would be great
>
> Jason > ">http://docs.yahoo.com/info/terms/


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



>If I use the I2c bus how far can I run it? The BCD was going to run
>over some distance but I could modify the project. If I cant ust the
>I2c bus maybe 485????not sure now.
>Re: Matrix Keypad Interface

Jason,

You can use on I2C buss over an extended range by using a
special chip at each end. The chip is type 82B17 and it is
made by Philips.

I use an I2C bus that is about 70-80 feet long. My hook-up
can be seen at http://zeus.ia.net/~kwradio/BasicX/ Some
claim to have used these chips for a mile long bus.

Regards,

John Ely, W0GN