Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

EXPERIMENT 04

Interfacing Keypad to 8051 Microcontroller and Displaying Results on SSD

Objective:

 Interfacing 4x3 keypad with 8051 microcontroller


 Displaying the pressed key number on seven segment display

Equipment:

 Hardware:
1. 8051 microcontroller
2. Seven segment displays (SSDs)
3. 4x3 Keypad
4. Resistances
 Software:
1. Keil µVision
2. SmartPRO 5000U
3. Proteus

Introduction:

Interfacing 8051 microcontroller to keypad helps in the design of various applications which control
different processes and actions by just a key press. One can design a password protected application using
keypad digits or provide users with different options represented by different digits by using keypad
interfacing.

Keypad:

A keypad is a block of buttons set with an arrangement of digits, symbols, or alphabetical letters. A
keypad is a specially designed circuitry which works on row and column selection operation. When a key
is pressed, a row is internally shorted with a column corresponding to that digit. A 4x3 keypad is shown
below:
A 4x3 keypad has12 individual push buttons and the configuration requires 13 input pins (one for each
key and a ground pin) in order to make them work. However, with matrix arrangement, one only needs 7
microcontroller pins (4-rows and 3-columns) to scan through the keypad.

The working principle of keypads is very simple. When a button is pressed, it shorts one of the row lines
to one of the column lines, allowing current to flow between them. For example, when key ‘4’ is pressed,
column 1 and row 2 are shorted.
The pins are connected at the top of keypad starting from left and advance toward right. Each pin should
be connected to one pin of an I/O port.
Scanning a Keypress:
A microcontroller can scan a keypress by following the given steps:
1. A microcontroller sets all the row lines to HIGH.
2. Then, it picks a row and sets it LOW and checks the column lines one at a time.
3. If the column connection stays HIGH, the button on the row has not been pressed.
4. If it goes LOW, the microcontroller figures which button was pressed corresponding to the
detected row and column.

Procedure:

 Verify all the pin connections of keypad by using voltmeter.


 Calculate the sequences required for all the keys of keypad depending on the type of SSD being
used.
 Write the code to interface 8051 microcontroller accordingly and generate hex file.
 Implement the circuit to interface keypad and SSD to the microcontroller.
 Verify the output displayed on SSD against each key press.

Lab Task 1:
Write a code to interface a 4x3 keypad with 8051 microcontroller, burn the hex file in microcontroller and
display the results on SSD. Verify these results in Proteus.
Lab Task 2:
Write a code to interface a 4x4 keypad with 8051 microcontroller and verify the results in Proteus.
Conclusion:

You might also like