You Are Here: Home » AVR ATmega Projects » Interfacing(USB - RS232 - I2c -ISP) Projects » How to interface keypad with AVR microcontroller (ATmega16)

How to interface keypad with AVR microcontroller (ATmega16)




Keypad is 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 interfacing it with any other microcontroller. The article of Interfacing keypad with 8051 can be referred for detailed description of the methodology used here. This article explains the interfacing of a 4×3 keypad with AVR microcontroller (ATmega16) and displaying the output on a LCD.

How to interface keypad with AVR microcontroller (ATmega16)

The algorithm and detailed explanation for keypad interfacing is given in above mentioned article. The brief steps to interface the keypad with AVR are written below:
1.                  Configure the row pins or column pins.
2.                  Make all output pins to low and input pins to high.
3.                  Keep monitoring the port value, where the key pad is connected.
 
How to interface keypad with AVR microcontroller (ATmega16) schematic
while(1)
{
PORTD=0xF0; //set all the input to one
value=PIND; //get the PORTD value in variable “value”
if(value!=0xf0) //if any key is pressed value changed
{
check1();
check2();
check3();
check4();
}
}

Leave a Comment

You must be logged in to post a comment.

Scroll to top