Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
35 views
4X4 Matrix Keypad
Uploaded by
govindandmanu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download now
Download
Save 4X4 Matrix Keypad For Later
Download
Save
Save 4X4 Matrix Keypad For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
35 views
4X4 Matrix Keypad
Uploaded by
govindandmanu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download now
Download
Save 4X4 Matrix Keypad For Later
Carousel Previous
Carousel Next
Save
Save 4X4 Matrix Keypad For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 6
Search
Fullscreen
4X4 Matrix Keypad:
Keypad with 8051 Interfacing Diagram:
Embedded C Code:
#include<reg51.h>
#define display_port P2 //Data pins connected to port 2 on microcontroller
sbit rs = P3^2; //RS pin connected to pin 2 of port 3
sbit rw = P3^3; // RW pin connected to pin 3 of port 3
sbit e = P3^4; //E pin connected to pin 4 of port 3
sbit C4 = P1^0; // Connecting keypad to Port 1
sbit C3 = P1^1;
sbit C2 = P1^2;
sbit C1 = P1^3;
sbit R4 = P1^4;
sbit R3 = P1^5;
sbit R2 = P1^6;
sbit R1 = P1^7;
void msdelay(unsigned int time) // Function for creating delay in milliseconds.
{
unsigned i,j ;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void lcd_cmd(unsigned char command) //Function to send command instruction to
LCD
{
display_port = command;
rs= 0;
rw=0;
e=1;
msdelay(1);
e=0;
}
void lcd_data(unsigned char disp_data) //Function to send display data to LCD
{
display_port = disp_data;
rs= 1;
rw=0;
e=1;
msdelay(1);
e=0;
}
void lcd_init() //Function to prepare the LCD and get it ready
{
lcd_cmd(0x38); // for using 2 lines and 5X7 matrix of LCD
msdelay(10);
lcd_cmd(0x0F); // turn display ON, cursor blinking
msdelay(10);
lcd_cmd(0x01); //clear screen
msdelay(10);
lcd_cmd(0x81); // bring cursor to position 1 of line 1
msdelay(10);
}
void row_finder1() //Function for finding the row for column 1
{
R1=R2=R3=R4=1;
C1=C2=C3=C4=0;
if(R1==0)
lcd_data('1');
if(R2==0)
lcd_data('4');
if(R3==0)
lcd_data('7');
if(R4==0)
lcd_data('*');
}
void row_finder2() //Function for finding the row for column 2
{
R1=R2=R3=R4=1;
C1=C2=C3=C4=0;
if(R1==0)
lcd_data('2');
if(R2==0)
lcd_data('5');
if(R3==0)
lcd_data('8');
if(R4==0)
lcd_data('0');
}
void row_finder3() //Function for finding the row for column 3
{
R1=R2=R3=R4=1;
C1=C2=C3=C4=0;
if(R1==0)
lcd_data('3');
if(R2==0)
lcd_data('6');
if(R3==0)
lcd_data('9');
if(R4==0)
lcd_data('#');
}
void row_finder4() //Function for finding the row for column 4
{
R1=R2=R3=R4=1;
C1=C2=C3=C4=0;
if(R1==0)
lcd_data('A');
if(R2==0)
lcd_data('B');
if(R3==0)
lcd_data('C');
if(R4==0)
lcd_data('D');
}
void main()
{
lcd_init();
while(1)
{
msdelay(30);
C1=C2=C3=C4=1;
R1=R2=R3=R4=0;
if(C1==0)
row_finder1();
else if(C2==0)
row_finder2();
else if(C3==0)
row_finder3();
else if(C4==0)
row_finder4();
}
}
LCD 16x2 Pinout:
LCD16x2 with 8051 Interfacing Diagram:
Embedded C Code:
#include <reg51.h> //Header Declaration
#include <string.h> //String Header Declaration
void delay_ms(unsigned int ms); // Delay function Declaration
//----------------------------------LCD pins and functions Declaration---------------------------//
#define LCD P1 // LCD Data Pins
sbit RS = P2^0;
sbit EN = P2^1;
void initlcd(void);
void cmd_lcd(unsigned char command);
void data_lcd(unsigned char databyte);
void Print_String(unsigned char *message);
//----------------------------------MAIN PROGRAM--------------------------------------//
void main(void)
{
unsigned char string[]="MP&MC LAB";
initlcd(); //initialise lcd
while(1)
{
cmd_lcd(0x80); //Print the String at First Line
Print_String(string);
cmd_lcd(0x0c); //Cursor Off
delay_ms(1000);
cmd_lcd(0x01); //Clear Screen
delay_ms(100);
}
}
//----------------------------------LCD funtions--------------------------------------//
void initlcd()
{
cmd_lcd(0x38); // 2 lines(16*2), 5*7 matrx
delay_ms(5);
cmd_lcd(0x0E); //Display On, Cursor ON
delay_ms(5);
cmd_lcd(0x01); //Clear Screen
delay_ms(5);
cmd_lcd(0x06); //Increment cursor
delay_ms(5);
cmd_lcd(0x80); //Cursor Home (1st line 1st position)
delay_ms(100);
}
void cmd_lcd(unsigned char command)
{
EN = 1;
RS = 0;
LCD=command;
EN = 0;
delay_ms(1);
}
void data_lcd(unsigned char databyte)
{
EN = 1;
RS = 1;
LCD=databyte;
EN = 0;
delay_ms(1);
}
void Print_String(unsigned char *message)
{
while(*message!='\0')
{
data_lcd( *message);
message++;
}
}
//----------------------------------Delay Routine--------------------------------------//
void delay_ms(unsigned int ms)
{
unsigned char t1;
unsigned int t2;
for(t1=0; t1<ms; t1++){
for(t2=0; t2<114; t2++);
}
}
You might also like
Salesforce AI Specialist
PDF
No ratings yet
Salesforce AI Specialist
7 pages
Build A Nginx Environment
PDF
No ratings yet
Build A Nginx Environment
7 pages
Electronic Code Lock
PDF
100% (10)
Electronic Code Lock
4 pages
LCD and Keyboard Interfacing With 8051
PDF
No ratings yet
LCD and Keyboard Interfacing With 8051
3 pages
Interfacing A LCD Display With 8051
PDF
100% (1)
Interfacing A LCD Display With 8051
7 pages
Technological University of The Philippines Ayala BLVD., Ermita, Manila College of Engineering
PDF
No ratings yet
Technological University of The Philippines Ayala BLVD., Ermita, Manila College of Engineering
7 pages
4x4 Matrix Key-Board Interfacing With ATmega32
PDF
100% (3)
4x4 Matrix Key-Board Interfacing With ATmega32
6 pages
Exp No.4
PDF
No ratings yet
Exp No.4
12 pages
8 Bit Hex To Decimal Conversion
PDF
100% (1)
8 Bit Hex To Decimal Conversion
20 pages
JHD162A LCD Code
PDF
100% (3)
JHD162A LCD Code
3 pages
#Includereg51 H
PDF
No ratings yet
#Includereg51 H
3 pages
Library Dependency Tree
PDF
No ratings yet
Library Dependency Tree
6 pages
TM4C123 with 4x4 matrix keypad
PDF
No ratings yet
TM4C123 with 4x4 matrix keypad
7 pages
Code
PDF
No ratings yet
Code
3 pages
LCD
PDF
No ratings yet
LCD
3 pages
How To Display Text On 16x2 LCD Using PIC18F4550 Microcontroller
PDF
100% (1)
How To Display Text On 16x2 LCD Using PIC18F4550 Microcontroller
4 pages
keykey
PDF
No ratings yet
keykey
6 pages
Exp1 LCD KBD
PDF
No ratings yet
Exp1 LCD KBD
5 pages
Unit III AP Part 1 Interfacing
PDF
No ratings yet
Unit III AP Part 1 Interfacing
122 pages
LCD
PDF
No ratings yet
LCD
6 pages
LCD 1
PDF
No ratings yet
LCD 1
10 pages
Flex LCD.C
PDF
100% (1)
Flex LCD.C
4 pages
VI Du Pic Dung C
PDF
100% (2)
VI Du Pic Dung C
48 pages
LCD C
PDF
No ratings yet
LCD C
4 pages
4X4 Keypad
PDF
No ratings yet
4X4 Keypad
6 pages
LCD
PDF
No ratings yet
LCD
4 pages
LCD 4 Bit Test MCB 2300
PDF
100% (2)
LCD 4 Bit Test MCB 2300
7 pages
KBDD
PDF
No ratings yet
KBDD
12 pages
Control2 Lcds
PDF
No ratings yet
Control2 Lcds
8 pages
LCD
PDF
100% (1)
LCD
2 pages
ADC Interfacing 8051 Code
PDF
No ratings yet
ADC Interfacing 8051 Code
2 pages
GSM1
PDF
No ratings yet
GSM1
10 pages
Void Main (For ( ) (Init Lcddata (10) ) )
PDF
No ratings yet
Void Main (For ( ) (Init Lcddata (10) ) )
2 pages
LCD Test
PDF
100% (1)
LCD Test
3 pages
Rew
PDF
No ratings yet
Rew
2 pages
LCD Interface
PDF
No ratings yet
LCD Interface
4 pages
exp9_WORD
PDF
No ratings yet
exp9_WORD
7 pages
LCD (16x2) User Guide
PDF
100% (1)
LCD (16x2) User Guide
5 pages
16x2 Basic LCD Driver Files XC8
PDF
100% (1)
16x2 Basic LCD Driver Files XC8
3 pages
LPC 2148
PDF
No ratings yet
LPC 2148
14 pages
Lcdfunctions C
PDF
No ratings yet
Lcdfunctions C
2 pages
PIRCODE
PDF
No ratings yet
PIRCODE
13 pages
Rudra 18
PDF
No ratings yet
Rudra 18
21 pages
Libreria LCD XC8 PDF
PDF
100% (3)
Libreria LCD XC8 PDF
2 pages
Hardware Interfaces To 8051: 1. LCD 2. Keyboard 3. ADC 4. DAC 5. Stepper Motor 6. DC Motor
PDF
No ratings yet
Hardware Interfaces To 8051: 1. LCD 2. Keyboard 3. ADC 4. DAC 5. Stepper Motor 6. DC Motor
32 pages
MCP_ALM 2
PDF
No ratings yet
MCP_ALM 2
11 pages
LCD Display
PDF
100% (1)
LCD Display
3 pages
Processor
PDF
No ratings yet
Processor
7 pages
Mod-5-LED-LCD-Keypad-ADC_DAC-full
PDF
No ratings yet
Mod-5-LED-LCD-Keypad-ADC_DAC-full
42 pages
LCD
PDF
No ratings yet
LCD
17 pages
As511 DB48 DW0
PDF
No ratings yet
As511 DB48 DW0
14 pages
18-Unnamed-04-02-2025
PDF
No ratings yet
18-Unnamed-04-02-2025
35 pages
Lesson 18 LCD Display
PDF
No ratings yet
Lesson 18 LCD Display
12 pages
Lesson 18 LCD Display
PDF
No ratings yet
Lesson 18 LCD Display
13 pages
LCD 2
PDF
No ratings yet
LCD 2
3 pages
TM4C123 TIVA kit with LCD”
PDF
No ratings yet
TM4C123 TIVA kit with LCD”
6 pages
Single Master Multi Slave Concept in I2c
PDF
100% (1)
Single Master Multi Slave Concept in I2c
37 pages
Name-Ashwin Kumar Course-B-Tech (Electronic and Communication Engineering) Passing Year-2019 College-NIT, Patna Mob-9006797862
PDF
No ratings yet
Name-Ashwin Kumar Course-B-Tech (Electronic and Communication Engineering) Passing Year-2019 College-NIT, Patna Mob-9006797862
8 pages
Write A Program For Interfacing The 16x2 LCD MODULES Aim
PDF
No ratings yet
Write A Program For Interfacing The 16x2 LCD MODULES Aim
7 pages
Exp No 5
PDF
No ratings yet
Exp No 5
8 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
Calculated Encryption
From Everand
Calculated Encryption
John C Livingstone
No ratings yet
Arrays and Strings
PDF
No ratings yet
Arrays and Strings
38 pages
Mining Pool Attack
PDF
No ratings yet
Mining Pool Attack
16 pages
Pseudocode For O Level Computer Science
PDF
50% (2)
Pseudocode For O Level Computer Science
16 pages
HUMAN-TECHNOLOGY COMMUNICATION internet-of robotic-things and ubiquitous. R. Anandandownload
PDF
100% (2)
HUMAN-TECHNOLOGY COMMUNICATION internet-of robotic-things and ubiquitous. R. Anandandownload
58 pages
229818964Sample Question Paper 2024
PDF
No ratings yet
229818964Sample Question Paper 2024
10 pages
TM-2235 AVEVA Marine (12 Series) Piping Catalogue and Specifications Rev 6.0
PDF
No ratings yet
TM-2235 AVEVA Marine (12 Series) Piping Catalogue and Specifications Rev 6.0
219 pages
Iisf Project
PDF
No ratings yet
Iisf Project
13 pages
Prototype Food Management
PDF
No ratings yet
Prototype Food Management
6 pages
Benefits and Limitations of Using Low-Code Development To Support
PDF
No ratings yet
Benefits and Limitations of Using Low-Code Development To Support
17 pages
3.0 Batch Functions
PDF
No ratings yet
3.0 Batch Functions
15 pages
Poka Yoke or Error Proofing
PDF
No ratings yet
Poka Yoke or Error Proofing
5 pages
SLM-Computer-Programming-Q4 MODULE 3
PDF
No ratings yet
SLM-Computer-Programming-Q4 MODULE 3
33 pages
React 18 Design Patterns and Best Practices, Fourth Edition (Early Access) Anonymous download
PDF
100% (2)
React 18 Design Patterns and Best Practices, Fourth Edition (Early Access) Anonymous download
40 pages
Online Eyeware Shop Synopsis
PDF
No ratings yet
Online Eyeware Shop Synopsis
6 pages
CH 02
PDF
No ratings yet
CH 02
19 pages
Assignment 2
PDF
No ratings yet
Assignment 2
3 pages
How Can I Insert Variable Into Formula in VBA: 2 Answers
PDF
No ratings yet
How Can I Insert Variable Into Formula in VBA: 2 Answers
2 pages
Coke One Data Enablement Strategy
PDF
No ratings yet
Coke One Data Enablement Strategy
109 pages
DLM Micro 8086 Lab
PDF
No ratings yet
DLM Micro 8086 Lab
11 pages
Samsung Mobile Price in Nepal
PDF
No ratings yet
Samsung Mobile Price in Nepal
8 pages
Windows PC Games
PDF
No ratings yet
Windows PC Games
13 pages
Experiment:1: The Objective of This Experiment Is To Know About Installation of Different Operating Systems Like Ubuntu
PDF
No ratings yet
Experiment:1: The Objective of This Experiment Is To Know About Installation of Different Operating Systems Like Ubuntu
11 pages
Cloud Digital Leader
PDF
100% (1)
Cloud Digital Leader
39 pages
Centennial College - Artificial Intelligence - Software Engineering Technology (Optional Co-op)
PDF
No ratings yet
Centennial College - Artificial Intelligence - Software Engineering Technology (Optional Co-op)
14 pages
ETI Micro Project
PDF
No ratings yet
ETI Micro Project
15 pages
Etabs v19 Lateral Loads Manual
PDF
100% (4)
Etabs v19 Lateral Loads Manual
315 pages
dsPIC30F Digital Signal Controllers - ds70095h
PDF
No ratings yet
dsPIC30F Digital Signal Controllers - ds70095h
22 pages
CIS Controls and ISO 27001 (Simple Mapping)
PDF
No ratings yet
CIS Controls and ISO 27001 (Simple Mapping)
4 pages