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

> 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
>
>
>
>
>
>
>
>

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.