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)
51 views
6 pages
4X4 Matrix Keypad
Uploaded by
govindandmanu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Download
Save
Save 4X4 Matrix Keypad For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
51 views
6 pages
4X4 Matrix Keypad
Uploaded by
govindandmanu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save 4X4 Matrix Keypad For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save 4X4 Matrix Keypad For Later
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
20461C Setup Guide
PDF
0% (1)
20461C Setup Guide
17 pages
Hobart WW Service-Manual GC-18-01-Visio-series en UK 0518-0621
PDF
No ratings yet
Hobart WW Service-Manual GC-18-01-Visio-series en UK 0518-0621
144 pages
Mod 5 LED LCD Keypad ADC - DAC Full
PDF
No ratings yet
Mod 5 LED LCD Keypad ADC - DAC Full
42 pages
TM4C123 With 4x4 Matrix Keypad
PDF
No ratings yet
TM4C123 With 4x4 Matrix Keypad
7 pages
COMP3250 Assignment 1
PDF
No ratings yet
COMP3250 Assignment 1
5 pages
Regarding Genaretes in The Process of Estimate Regret Concern Despite Estimates Think Capture
PDF
No ratings yet
Regarding Genaretes in The Process of Estimate Regret Concern Despite Estimates Think Capture
3 pages
Mod 5
PDF
No ratings yet
Mod 5
99 pages
Unit III AP Part 1 Interfacing
PDF
No ratings yet
Unit III AP Part 1 Interfacing
122 pages
Toshiba VF S11 Manual
PDF
No ratings yet
Toshiba VF S11 Manual
255 pages
CCNA1 Final Exam Answer 2016 v5
PDF
No ratings yet
CCNA1 Final Exam Answer 2016 v5
68 pages
Optima XR200amx: Mobile Digital-Ready Radiographic System
PDF
No ratings yet
Optima XR200amx: Mobile Digital-Ready Radiographic System
4 pages
LCD Display
PDF
100% (1)
LCD Display
3 pages
Information and Communication Technology: Class XI-XII
PDF
No ratings yet
Information and Communication Technology: Class XI-XII
222 pages
Module 7
PDF
No ratings yet
Module 7
48 pages
LCD Test
PDF
100% (1)
LCD Test
3 pages
Manage Quaility: Varun Anand, PMP +1-833-338-7768
PDF
No ratings yet
Manage Quaility: Varun Anand, PMP +1-833-338-7768
15 pages
LCD
PDF
100% (1)
LCD
2 pages
As511 DB48 DW0
PDF
No ratings yet
As511 DB48 DW0
14 pages
LCD 4 Bit Test MCB 2300
PDF
100% (2)
LCD 4 Bit Test MCB 2300
7 pages
MC Unit - 5 All Ans
PDF
No ratings yet
MC Unit - 5 All Ans
43 pages
How To Display Text On 16x2 LCD Using PIC18F4550 Microcontroller
PDF
100% (2)
How To Display Text On 16x2 LCD Using PIC18F4550 Microcontroller
4 pages
Flex LCD.C
PDF
100% (1)
Flex LCD.C
4 pages
Libreria LCD XC8 PDF
PDF
100% (3)
Libreria LCD XC8 PDF
2 pages
Meta Search Engine Using Distributed Information Retrieval
PDF
No ratings yet
Meta Search Engine Using Distributed Information Retrieval
35 pages
16x2 Basic LCD Driver Files XC8
PDF
100% (1)
16x2 Basic LCD Driver Files XC8
3 pages
VI Du Pic Dung C
PDF
100% (2)
VI Du Pic Dung C
48 pages
Exp No.4
PDF
No ratings yet
Exp No.4
12 pages
Rudra 18
PDF
No ratings yet
Rudra 18
21 pages
Electronic Devices: Floyd
PDF
No ratings yet
Electronic Devices: Floyd
40 pages
Report
PDF
No ratings yet
Report
16 pages
MCP - Alm 2
PDF
No ratings yet
MCP - Alm 2
11 pages
8 Bit Hex To Decimal Conversion
PDF
100% (1)
8 Bit Hex To Decimal Conversion
20 pages
LCD (16x2) User Guide
PDF
100% (1)
LCD (16x2) User Guide
5 pages
PIRCODE
PDF
No ratings yet
PIRCODE
13 pages
4X4 Keypad
PDF
No ratings yet
4X4 Keypad
6 pages
LCD and Keyboard Interfacing With 8051
PDF
No ratings yet
LCD and Keyboard Interfacing With 8051
3 pages
#Includereg51 H
PDF
No ratings yet
#Includereg51 H
3 pages
LPC 2148
PDF
No ratings yet
LPC 2148
14 pages
4x4 Matrix Key-Board Interfacing With ATmega32
PDF
100% (3)
4x4 Matrix Key-Board Interfacing With ATmega32
6 pages
LCD
PDF
No ratings yet
LCD
6 pages
Keykey
PDF
No ratings yet
Keykey
6 pages
Interfacing A LCD Display With 8051
PDF
100% (1)
Interfacing A LCD Display With 8051
7 pages
Exp9 WORD
PDF
No ratings yet
Exp9 WORD
7 pages
Void Main (For ( ) (Init Lcddata (10) ) )
PDF
No ratings yet
Void Main (For ( ) (Init Lcddata (10) ) )
2 pages
Rew
PDF
No ratings yet
Rew
2 pages
Code
PDF
No ratings yet
Code
3 pages
LCD Interface
PDF
No ratings yet
LCD Interface
4 pages
Matrix Keyboard
PDF
No ratings yet
Matrix Keyboard
2 pages
Library Dependency Tree
PDF
No ratings yet
Library Dependency Tree
6 pages
GSM1
PDF
No ratings yet
GSM1
10 pages
Lcdfunctions C
PDF
No ratings yet
Lcdfunctions C
2 pages
MC Edited
PDF
No ratings yet
MC Edited
11 pages
Control2 Lcds
PDF
No ratings yet
Control2 Lcds
8 pages
LCD
PDF
No ratings yet
LCD
4 pages
KBDD
PDF
No ratings yet
KBDD
12 pages
Major Project - Grid Solving Robot
PDF
57% (7)
Major Project - Grid Solving Robot
84 pages
ADC Interfacing 8051 Code
PDF
No ratings yet
ADC Interfacing 8051 Code
2 pages
Processor
PDF
No ratings yet
Processor
7 pages
LCD
PDF
No ratings yet
LCD
17 pages
LCD Interfacing Program
PDF
No ratings yet
LCD Interfacing Program
3 pages
Thư Viện Lcd
PDF
No ratings yet
Thư Viện Lcd
4 pages
PR 1 Research
PDF
No ratings yet
PR 1 Research
57 pages
ACE6000 User Guide - FW - V2 65bis
PDF
No ratings yet
ACE6000 User Guide - FW - V2 65bis
93 pages
LCD
PDF
No ratings yet
LCD
3 pages
LCD 1
PDF
No ratings yet
LCD 1
10 pages
Carding
PDF
0% (1)
Carding
1 page
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
My Siwes Report
PDF
No ratings yet
My Siwes Report
48 pages
TQM Clause 45
PDF
No ratings yet
TQM Clause 45
4 pages
Employee'S Timekeeping & Cos Form: For Offset Day (OS)
PDF
No ratings yet
Employee'S Timekeeping & Cos Form: For Offset Day (OS)
1 page
Information Security Challenges: A Malaysian Context: Adnan Rizal Haris@Harib, Suhaimi Sarijan and Norhayati Hussin
PDF
No ratings yet
Information Security Challenges: A Malaysian Context: Adnan Rizal Haris@Harib, Suhaimi Sarijan and Norhayati Hussin
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
Exp1 LCD KBD
PDF
No ratings yet
Exp1 LCD KBD
5 pages
LCD C
PDF
No ratings yet
LCD C
4 pages
Expert Evaluation Form PK
PDF
No ratings yet
Expert Evaluation Form PK
2 pages
Unit Ii: Sensor Networks - Introduction & Architectures
PDF
No ratings yet
Unit Ii: Sensor Networks - Introduction & Architectures
8 pages
Demystifying Noise Spectre Example
PDF
No ratings yet
Demystifying Noise Spectre Example
20 pages
Electronic Code Lock
PDF
100% (10)
Electronic Code Lock
4 pages
JHD162A LCD Code
PDF
100% (3)
JHD162A LCD Code
3 pages
03 Seatwork 1 ProjectManagement SenisRachel
PDF
No ratings yet
03 Seatwork 1 ProjectManagement SenisRachel
2 pages
C 5
PDF
No ratings yet
C 5
9 pages
Tacacs Huawei
PDF
No ratings yet
Tacacs Huawei
1 page
PROJECT PROPOSAL FOR jetPOINT
PDF
No ratings yet
PROJECT PROPOSAL FOR jetPOINT
17 pages
LG 20LS5R Chassis LP68A PDF
PDF
No ratings yet
LG 20LS5R Chassis LP68A PDF
30 pages
Project
PDF
No ratings yet
Project
42 pages
Securing Nomad
PDF
No ratings yet
Securing Nomad
28 pages
Python - How To Draw A Heart With Pylab - Stack Overflow
PDF
No ratings yet
Python - How To Draw A Heart With Pylab - Stack Overflow
5 pages
Projects With Microcontrollers And PICC
From Everand
Projects With Microcontrollers And PICC
Guillermo Perez Guillen
5/5 (1)
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