Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] matrix keyboard

2004-12-16 by Dave VanHorn

At 05:31 PM 12/16/2004, vifra gomez wrote:


>hello..any one can help me please..
>
>i have a matrix kaeyboard with 12 outs..
>and the keyboard its 4*4 ,,,how to connect to a avr..
>
>and some code..please..

I can't really figure what you mean here..
Normally you'll have some number of rows, and a number of columns.
Rows and columns are interchangeable at design time.

On the AVR, it's easiest to set up the inputs with pullups on, and output 
lows to the keyboard. (all outputs high when idle) So, you could do it as 
four rows on four output pins, and four inputs on four column pins.  Now 
you scan a low across each output, and look for lows on the inputs.

If you see all columns high, then no keys are pressed.
If you put a low on row 1 and you get a low on column 3 then you know that 
switch is closed.

How fast you scan is up to you, as well as how you debounce the switches.
If you scan slowly, you may not even need debouncing.

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.