Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] The keyboard

2005-02-18 by Jesper Hansen

> Were you say "Set values 0xE0, 0xD0, 0xB0, 0x07 on PA4..7 and watch PA0..3 
> for a low to
> see which key is was."
> I think there is a typing error and 0x07 should be 0x70,

Oops, yes, it has to be 0x70 ofcourse. The idea is to just have a single row 
low.

> But I was thinking of
> Setting values 0x10, 0x20, 0x40, 0x80 on PA4..7 and watch PA0..3 for a 
> high to
> see which key is was.

The idea is the same, but then you would have to add pulldown resistors on 
the column lines.
Why not take advantage of the built in pullup resistors on the AVR port pins 
?

> The keypad I have is a telephone type 3*4 alphanumeric with a 1*4 A to D 
> column. what I program it for
> could be numbered, I could do a long press for numbers short press for 
> letters and two  and three short
> presses for 2nd and 3rd letter, but one has to look at the cheap quality 
> of the rubbish keypad and how
> long before maximum key bounce, I might go better for a "two button" press 
> to get the letters, press A
> and another key to get the first letter, B and anther button to get the 
> second button

Contact bounce is usually just a few mS. You'd have plenty of time to wait 
for debounce and still be able
to detect the various types of keypresses.

/Jesper

> From Eric
>
>
>
>
> ----- Original Message -----
> From: "Jesper Hansen" <jesperh@telia.com>
> To: <AVR-Chat@yahoogroups.com>
> Sent: Saturday, February 19, 2005 2:31 AM
> Subject: Re: [AVR-Chat] The keyboard
>
>
>
>> Hi what a failure the project is.
>>
>> I was planning to put a 4*4 keyboard on portA of a ATmega32, sending F0 
>> to
>> the data direction register &
>> the data port.
>>
>> this is the "test" plan, to put 1's on all the rows, the loop will look
>> for a 1 on the columns,  when it
>> finds a 1 the beeper will beep, then I will continue to write the code so
>> to put information on the LCD
>> from the keyboard after strobbing the rows one by one.
>
> Bad plan, the inputs are floating.
>
> Assuming rows are on PA4..PA7 and columns on PA0..PA3 :
> Write 0xF0 to DDRA to set PA0..PA3 as inputs and PA4..PA7 as outputs
> Write 0x0F to PORTA to activate the pullups on PA0..PA3 and set all rows
> low.
> Read PINA and AND with 0x0F, if the result is different from 0x0F, a key 
> is
> pressed.
> Set values 0xE0, 0xD0, 0xB0, 0x07 on PA4..7 and watch PA0..3 for a low to
> see which
> key is was.
>
>>
>> I got it to work alright on the studio program, it loops round looking 
>> for
>> a 1 on the columns,  but it
>> fails when I download it to the micro,
>> I have got the port lines going direct to the keyboard,  should I put say
>> 10K resistors on the input
>> ports? or use some other hardware ideas?
>>
>>
>>
>> From Eric
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.