Arduino Projects    |   Raspberry Pi  |     Electronic Circuits   |    AVR    |    PIC    |    8051    |    Electronic Projects

How to make an alphabetic keypad using 8051 microcontroller (AT89C51)


Developed By: 
Himanshu Choudhary

An alphabetic keypad is similar to a numeric keypad, but it provides the complete set of alphabetical letters instead of numbers 0-9. This article presents a way to interface a keypad with 8051 microcontroller (AT89C51) to display alphabetical characters on an LCD module. Such kind of systems is commonly used in mobile phones to write an SMS and other texts. It can have further applications in displaying instant messages on other display systems such as LED matrices or other multi-segment displays.

How to make an alphabetic keypad using 8051 microcontroller (AT89C51)


A 4x3 matrix keypad and a 16x2 LCD has been used here. Keypad and LCD are very commonly used input & output devices, respectively.
The connections in the circuit are as following: port P2 of microcontroller AT89C51 is used as data input port which is connected to data pins (7-14) of LCD. P3^0, P3^1 and P3^2 pins of microcontroller are connected to control pins RS, RW and EN of LCD. Port P0 is used to take input from keypad. Also refer to Keypad interfacing with AT89C51.


The alphabetic pattern or letter mapping used in this system is depicted in the following figure:






Every key is assigned with a variable to count the number of times it has been pressed. The count is set to zero initially and increases by one when the same key is pressed again.



On first count, the first alphabet of the key from its letter map is displayed on LCD. For example, if Key1 is pressed when its count is 0, then ‘a’ appears on the LCD screen. After this operation, the count increases to 1.






The second letter of the alphabetic pattern is shown on the display module when the same key is pressed again. This time the count increases again to 2 and second alphabet is displayed at same position. Thus, we get ‘b’ on display if Key1 is used twice.





When the same key is pressed third time, its count value changes to 3. This time the third alphabet of the letter pattern gets displayed on screen replacing the previous alphabet. For the considered case, ‘c’ appears on the LCD screen when Key1 is pressed thrice in a row.







The count is reset to zero after it reaches to a value of 3. After this execution, the position on LCD is shifted to right to allow the second letter to be printed there.




Therefore, pressing the same key four times consecutively, the first alphabet from its letter map reappears in succession to the last letter. Here, ‘a’ gets displayed on LCD after ‘c’ when Key1 is used four times.






In other words, if a key is pressed more than thrice in a row, the count resets to zero and it’ll behave as a new alphabetic key. Thus the same modes of operations continue on repeated access of the keypad buttons.






Key0 of this keypad is set for to provide a blank space ‘ ’ while Key* provides the functionality of backward movement while writing a text on LCD. Key# of the keypad is configured for forward movement.




The 16x2 LCD can display only 16 characters in a line. Therefore, after 16th letter appears on screen, the cursor position is moved and 17th letter gets displayed on the first position of 2nd line of LCD. Similarly, 23rd letter appears back on the first line and so on.






Circuit Diagram



This Code is only visible to Registered users. Please Login/Register



Presets | Variable Resistors
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a small screw driver or...
AT89C51 Microcontroller, Atmel 89C51 Controller Image
AT89C51 Microcontroller

AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (...

16 x 2 LCD | 16x2 Character LCD Module


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...

You are here