Atmel AVR Microcontroller discussion group.
Re: [AVR club] keypad question - jay marante - Mar 17 20:42:00 2004
Yeah... Thats exactly the same hardware i used. I just
took off one pin since i used only 3 column. Follow
the same hardware found at the atmel application
notes. Youll just have to add two lines of code on
your program -- thats detecting the column and row --
and thats it. Good luck. -jay
--- chrisatwan2000@chri...
<chrisatwan2000@chri...> wrote:
> Jay,
>
> The atmel example I was trying to follow with the
keypad is the one that uses 4 diodes for the 4
columns. Is this ok with the code you sent me?
>
> Chris Atwan
>
> jay marante <jaythesis@jayt...> wrote:
> yeah... you'll just have to use the last pin (PINA7)
for the last column. maybe you'll have to adjust the
connections since i don't know exactly where the last
pin is located at the keypad.
>
> note: use the lower nibble of the port for the rows
and the high nibble for the columns.
>
> -jay
>
> chris atwan <chrisatwan2000@chri...> wrote:
> Jay,
>
> Should this code be able to change for a 4x4 keypad?
I need 16 keys for my toy.
>
> Chris Atwan
>
> jay marante <jaythesis@jayt...> wrote:
> here's the pin outs:
>
> keypad (4x3)
MCU (Port A)
> Pin 1 (2nd col)
PA5
> Pin 2 (1st row)
PA3
> Pin 3 (1st col)
PA6
> Pin 4 (4th row)
PA0
> Pin 5 (3rd col)
PA4
> Pin 6 (3rd row)
PA1
> Pin 7 (2nd row)
PA2
>
> you may verify that with an ohmmeter by tappping the
pins between the row and the column and pressing the
key. example, tapping pin 2 (1st row) with pin 3 (1st
col) should be the # 1. ;)
>
> when testing with the AVR simulator, set first PIND2
to high so that it wont generate an interrupt since i
enabled the pull-up, so we assume that the MCU will
always read "1" on its port when there is no interupt
generated. then set PIND2 to low when you want to
generate an interrupt. also, together with PIND2, set
to high the low nibble of port A. this is because we
will read the rows first, and since we also enabled
the pull-up resistors. but set one bit to low. setting
1 bit to low means that you pressed that key (say
PINA3) if you pressed 1. then continue until when
you're about to read the columns. set two bits of the
high nibble (from PINA4 to PINA6 -- they are the
columns). still we set 1 bit to low (say PINA6 since
we pressed # 1) for the MCU to read. and that's it.
>
> anyways, the explanation is on the atmel application
notes though the code is written in assemble. yet they
are still the same. ;)
>
> -jay
>
> chris atwan <chrisatwan2000@chri...> wrote:
> Jay,
>
> I feel bad asking you this after all the help you
have given me. What did the hardware setup look like
for the keypad to the at90s8515?
>
> Chris Atwan
>
> jay marante <jaythesis@jayt...> wrote:
> i used the latest version of the ICCAVR.
>
> chris atwan <chrisatwan2000@chri...> wrote: Jay,
>
> Was this written in Codevision?
>
> Chris
>
> jay marante <jaythesis@jayt...> wrote:
> here, try this.
>
> i used a 4x3 keypad and 7.3728MHz of crystal.
> this was my first program in AVR actually. :-)
> good luck.
>
> -jay
> chris atwan <chrisatwan2000@chri...> wrote:
> Jay,
>
> Well I would be interested in seeing it if you can
find it.
>
> Chris Atwan
>
> jay marante <jaythesis@jayt...> wrote:
> nahh... i think it's in assembly.
>
> i have 1 before using the AT90S8515 but i think i
lost it. :)
>
> -jay
>
=== Message Truncated ===
__________________________________
">http://mail.yahoo.com

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )