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
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 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
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 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
Maestro Docking Step
PDF
No ratings yet
Maestro Docking Step
29 pages
Electronic Code Lock
PDF
100% (10)
Electronic Code Lock
4 pages
New Frontiers in Social Neuroscience
PDF
100% (1)
New Frontiers in Social Neuroscience
230 pages
Homework 1: Exercise 1.13
PDF
No ratings yet
Homework 1: Exercise 1.13
8 pages
JCB Transmission Repair Manual
PDF
40% (10)
JCB Transmission Repair Manual
8 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
Introduction To Data Warehousing Types
PDF
No ratings yet
Introduction To Data Warehousing Types
13 pages
17 1999ply Drops Composites Part B
PDF
No ratings yet
17 1999ply Drops Composites Part B
12 pages
24 Channel Data Decoder: Instruction Manual
PDF
No ratings yet
24 Channel Data Decoder: Instruction Manual
8 pages
Rocket Propulsion Primer: Subramaniam Krishnan Jeenu Raghavan
PDF
No ratings yet
Rocket Propulsion Primer: Subramaniam Krishnan Jeenu Raghavan
427 pages
Al-Qawaid Al-Fiqhiyyah
PDF
67% (3)
Al-Qawaid Al-Fiqhiyyah
411 pages
Materi Biographical Recount
PDF
No ratings yet
Materi Biographical Recount
14 pages
Iida Fvi Station Improvement
PDF
No ratings yet
Iida Fvi Station Improvement
10 pages
7. Alternating Current
PDF
No ratings yet
7. Alternating Current
30 pages
Introduction To JavaScript For Photoshop Scripting
PDF
No ratings yet
Introduction To JavaScript For Photoshop Scripting
9 pages
BASE DE HUMIDIFICACAO VHB15A Operators Manual
PDF
No ratings yet
BASE DE HUMIDIFICACAO VHB15A Operators Manual
28 pages
Esp32 S Ai - Datasheet
PDF
No ratings yet
Esp32 S Ai - Datasheet
2 pages
Vol 4 02
PDF
No ratings yet
Vol 4 02
11 pages
Periyar University: Annexure - 4
PDF
No ratings yet
Periyar University: Annexure - 4
29 pages
737 Book NG 52 303
PDF
No ratings yet
737 Book NG 52 303
42 pages
Rizky Spesifikasi Total Station Trimble M1 081220316619
PDF
No ratings yet
Rizky Spesifikasi Total Station Trimble M1 081220316619
2 pages
Coolant SpecificationSBGEN172E2 PDF
PDF
No ratings yet
Coolant SpecificationSBGEN172E2 PDF
1 page
Application of Mathematics in Social Sciences
PDF
No ratings yet
Application of Mathematics in Social Sciences
3 pages
Investigate The Seismic Response of Elevated Concrete Water Tank
PDF
No ratings yet
Investigate The Seismic Response of Elevated Concrete Water Tank
7 pages
Introduction To Robotics
PDF
No ratings yet
Introduction To Robotics
50 pages
Component Object Model (COM) Is A Binary Interface
PDF
No ratings yet
Component Object Model (COM) Is A Binary Interface
7 pages
Logic PCB: CA FAMOSA CF220/250/260 Wiring Diagram 220 V - 240 V
PDF
No ratings yet
Logic PCB: CA FAMOSA CF220/250/260 Wiring Diagram 220 V - 240 V
1 page
Technical Datasheet - DWK.O.10.100.37.5.0D.R
PDF
No ratings yet
Technical Datasheet - DWK.O.10.100.37.5.0D.R
4 pages
Lesson - Spinner Bingo
PDF
No ratings yet
Lesson - Spinner Bingo
3 pages
078BCE054
PDF
No ratings yet
078BCE054
12 pages
S. Pedersen Shima v12n2
PDF
No ratings yet
S. Pedersen Shima v12n2
6 pages
D19 HT Switchgear-Ds-A
PDF
No ratings yet
D19 HT Switchgear-Ds-A
6 pages