Keyboard is the most widely used input device to provide information from the external world to the microcontroller. The keyboard makes the application more interactive for users. The concept of interfacing a keyboard with the ATmega16 is similar to interfacing with any other microcontroller. The article Keyboard interface with 8051 can be consulted for a detailed description of the methodology used here. This article explains interfacing a 4x3 keyboard with the AVR microcontroller (ATmega16) and displaying the output on an LCD.
The algorithm and detailed explanation of the keyboard interface are provided in the article mentioned above. The brief steps to connect the keyboard to the AVR are outlined below:
1. Configure row or column pins.
two. Set all output pins low and input pins high.
3. Continue monitoring the value of the port where the keyboard is connected.
while(1)
4. If there is any change in the port value, set one of the port output pins to zero and leave everything high.
null check 1 (null)
{
//DDRD = 0xf0;
block =0b11111110;
//pad &= (0<5. If any input pin is zero, write the specific pin data to the LCD, otherwise continue with step (4).
Project source code
###
// Program to take keyboard input and display it on the LCD.
###
Circuit diagrams
Circuit diagram of how to interface the keyboard with the AVR-ATmega16 microcontroller |
Project Components
- ATmega16
- LCD
- Default