Shopping Cart

0 item(s) - Rs.0.00
Your shopping cart is empty!
Please update your Flash Player to view content.

. . . FOLLOW  US







 
 
Interfacing Matrix Keypad to 8051
Tutorial - 8051 Tutorial
Written by Amol Shah   

Before learning “Interfacing Matrix Keypad to Microcontroller” you should know how to interface a switch to microcontroller for which please click here.

 

Matrix_Keypad
Matrix Keypad

As you have seen in the article for interfacing switches to microcontroller normally the port pin is high but when a switch is pressed the controller pin gets a Low signal and we come to know that a switch has been pressed. One end of switch is connected to the port pin whereas the other end is connected to the Ground.

In case of matrix Keypad both the ends of switches are connected to the port Pin. Over here we have considered a 4x3 matrix keypad i.e. four rows and three columns. So in all twelve switches have been interfaced using just seven lines.

The adjoining figure shows the diagram of a matrix keypad and how it is interfaced with the controller.

As you can see no pin is connected to ground, over here the controller pin itself provides the ground. We pull one of the Column Pins low & check the row pins if any of the Pin is low then we come to know which switch is pressed.

Suppose we make column 1 pin low and while checking the rows we get Row 3 is low then we come to know switch 7 has been pressed.

matrix_keypad1

Interfacing Matrix Keypad to 8051

 

 

 

ALGORITHM

 

 

1.    Start.

 

2.    Make All Pins High.

 

3.    Make Column 1 pin low.

 

4.    Check if Row 1 is low, if yes then Switch 1 has been pressed.

 

5.    Check if Row 2 is low, if yes then Switch 4 has been pressed.

 

6.    Check if row 3 is low if yes then Switch 7 has been pressed.

 

7.    Check if row 4 is low if yes then Switch 10 has been pressed.

 

8.    Make Column 1 Pin high & Column 2 Pin Low.

 

9.    Check if Row 1 is low, if yes then Switch 2 has been pressed.

 

10.   Check if Row 2 is low, if yes then Switch 5 has been pressed.

 

11.   Check if row 3 is low if yes then Switch 8 has been pressed.

 

12.   Check if row 4 is low if yes then Switch 11 has been pressed.

 

13.   Make Column 2 Pin high & Column 3 Pin Low.

 

14.   Check if Row 1 is low, if yes then Switch 3 has been pressed.

 

15.   Check if Row 2 is low, if yes then Switch 6 has been pressed.

 

16.   Check if row 3 is low if yes then Switch 9 has been pressed.

 

17.   Check if row 4 is low if yes then Switch 12 has been pressed.

 

18.   Make column 3 pin high.

 

19.   Stop.

 

Please make sure at any time only one column Pin should remain Low.

 

For the complete working code in Assembly please check the code library or click here.

 

 
 

Featured

Latest

EEPROM 24C64
Rs.35.00
EEPROM 24C512
Rs.90.00
EEPROM 24C32
Rs.25.00
EEPROM 24C256
Rs.75.00
 
 
 
.
 TUTORIALS
.
  8051 Tutorial
 
  Power Supply
 
CODE LIBRARY
.

  8051 Assembly
 
  C Code Library
 

.
 PROJECTS
.
  Project List
 
  Synopsis and Abstract
 
DOWNLOADS
.

  Datasheets
 
  Download
 

.
 POPULAR
.
  About Us
 
  DNA Shop
 
  Totorial
 
  Code Library
 
  Download
 

.
CONTACT US
.

Mr. Amol Shah

DNA Technology Nashik,

Maharashtra 422009 India

Phone : 0253-3023939

Mobile : 09225145135

Email : contact@dnatechindia.com