Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Alphanumeric keypad with 8051(89c51,89c52) microcontroller

By EG Projects June 30, 2019

This tutorial teachs you how an alphanumeric keypad can be designed with 89c51 microcontroller, 16×2 lcd and 4×4 keypad? The main crux of the project lies in the code of the project. 4×4 keypad is just a cluster of buttons, arranged in coulomb and row orders. To use its buttons we have to write a software routine for each keypad button in our main code. Since buttons performed what they are programmed by us in the code. Hence we can take any function from the buttons. Usually we map them as the keypad keys printed on the physical keypad. In this tutorial we will map the keypad with multiple numbers and characters. A single button can enter multiple numbers or characters map to it.

The layout of alphanumeric keypad which i am going to program is below. In first 2 rows each button is assigned 3 characters and 1 number. Next row buttons are mapped to special characters and each button can enter 3 alphabets. Last row is assigned with mathematical operators and up to 2 mathematical operators can be entered by 1 button.  

Alphanumeric key pad with microcontroller keys layout

Alphanumeric key pad with microcontroller keys layout

Alphanumeric Keypad Hardware requirements

  • 4×4 keypad
  • 16×2 lcd
  • One 80s51 0r 89c51
  • Oscillator to provide necessary clock frequency to micro controller.
  • A potentiometer/variable resistor for setting 16×2 lcd contrast.

Alphanumeric keypad circuit diagram

4×4 keypad is connected to Port-1 of 8051(89c51,89c52) microcontroller. 16×2 lcd is connected to Port-2 of 89c51 microcontroller. 16×2 lcd controller controlling pins are connected to Port-3 of 8051 microcontroller. All the other connections are power connections for 8051 microcontroller. Aplly 5 volts to pin#31 and 40 of 8051 microcontroller. Insert 11.0592 MHz crystal between pins 18 and 19 of 8051 controller in parralel to two 33 pf capacitors. Connect your reset circuit to pin#9 of 89c51.    
8051 Alphanumeric keypad circuit diagram

8051 Alphanumeric keypad circuit diagram

Alphanumeric keypad 8051 code

First of all never forget to include the #include<reg51.h> header file in every 8051 project because this is the file which contains all the necessary linking and debugging code in it for keil compiler. Next some functions and their definitions with working principle.

  • void keypad() Identifying pressed buttons.
  • void cmd(char c) Sending commands to the lcd.
  • void delay(int num) Necessary delay function.
  • void lcdinit() Initializing the lcd and its driver chip set.
  • void lcddata(char c) Sending data to lcd.

The statement sfr dataport=0xA0  is accessing Port-2 of 8051 with its sfr. Then coulomb and row pins are defined on Port-1 of 89c51. 16×2 lcd rw and en(To learn about rw and en click the link) pins are defined at Port-3 pin number 5 and 6.
Next comes my main function starts first with the lcdinit() function. It initializes the lcd 16×2 and its driver chip set. Ten i am printing  the string  “PLEASE ENTER YOUR NAME ” on my lcd after some time this message disappears and  you can enter your name using 4×4 keypad.

Download the Project files and Code(C++,HEX). Code is written in C++ language and keil u-vision4 is used to compile the code and generate Hex code. Please give us your feed back on the project. If you have any queries, write them below.

Watch the project video below

Alphanumeric Keypad with 8051(89c51,89c52 code)


Filed Under: 8051 Microcontroller, Electronic Projects, Microcontroller Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • The Analog Gods Hate Me
  • Battery Deep Discharge – IC Workarounds?
  • Safe Current and Power Density Limits in PCB Copper(in A/m² and W/mÂł) simulation
  • Why so few Phase shift full bridge controllers?
  • Apc 650 upa

RSS Electro-Tech-Online.com Discussions

  • Simple LED Analog Clock Idea
  • The Analog Gods Hate Me
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • PIC KIT 3 not able to program dsPIC
  • Parts required for a personal project

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • Tria modules integrate edge AI processing with multi-core processors
  • pSemi introduces RF switch with 52 dBm PMAX,PEAK and 90-dBm IIP3 linearity
  • XP Power launches 1.3 kW power supply with 58.9 W/cmÂł density
  • How to enable Wi-Fi provisioning in ESP32-based IoT products
  • Amphenol RF introduces FAKRA to SMA adapters with 4 GHz operating frequency

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe