Interfacing matrix keyboard with AVR

The keypad is the most widely used input device to provide input from the outside world to the microcontroller. The keypad makes an application more users interactive.  The concept of interfacing a keypad with the ATmega16 is similar to interface it with any other microcontroller. Many applications require a large number of keys connected to a computing system which includes a PC keyboard, Cell Phone keypad, and Calculators. If we attach a single key to MCU, we connect it directly to i/o line. But we cannot connect; say 10 or 100 keys directly MCUs because it will eat up precious i/o line and MCU to Keypad interface will contain lots of wires. The rows R0 to R3 are Input to the Microcontroller. They are made an input by setting the proper DDR Register in AVR. The columns C0 to C3 are also connected to MCUs i/o line. These are kept at High Impedance State (AKA input); in high z state (z= impedance) state, these pins are neither HIGH nor LOW they are in TRI-STATE. And in their PORT value, we set them all…

Continue reading