This is a 4x4 keypad that displays letters on the lcd screen based on which key has been pressed. Built using an atmega328p, a 4x4 keypad, a resistor and lcd screen. The code runs on C.
Basic components required are:
- Microcontroller (Atmega 328p-pu)
- Crystal for timing operations (16Mhz crystal)
- Lcd 1602A
- Power source
- Wires (male to female and male to male wires)
- A programmer (usbtinyisp or any other)
- Board (copper board or bread board)
- Wires
Set up the circuit as shown in the figure below
A video of the code running
In this case I was using the terminal from linux
Install avr gcc by running the following command
sudo apt-get install gcc-avr binutils-avr avr-libc
Install avrdude by running
sudo apt-get install avrdude
To upload the code to the chip, one can run these commands:
The following compiles the code to a .obj file
avr-gcc -g -Os -Wall -mcall-prologues -mmcu=atmega328p -fno-exceptions -o main.obj main.c
The following code compiles the code to a .hex file
avr-objcopy -R .eeprom -O ihex main.obj main.hex
The following code uploads the .hex file to the chip (in this case I was using a usbtinyisp)
avrdude -b 19200 -c usbtiny -p m328p -U flash:w:main.hex para gravar no atmega
This are the references I used
-
Patrick Hood Daniel, using a 4x4 keypad https://www.youtube.com/watch?v=6FjrKXmquxU&t=898s
-
Avr Microcontroller and Embedded Systems The: Using Assembly and C Book by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi
-
For the lcd screen http://www.avr-tutorials.com/projects/atmega16-avr-microcontroller-lcd-digital-clock