0% found this document useful (0 votes)
21 views3 pages

8051 Keypad Interfacing

This document describes an experiment interfacing a 4x4 keypad to an 8051 microcontroller and LCD. The program scans the keypad rows and columns to detect key presses and displays the corresponding number or character on the LCD. It initializes the LCD, then continuously scans the keypad rows in a loop, using logic to determine the key pressed based on the row and column, and displays the character on the LCD.

Uploaded by

c2ecehod
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
0% found this document useful (0 votes)
21 views3 pages

8051 Keypad Interfacing

This document describes an experiment interfacing a 4x4 keypad to an 8051 microcontroller and LCD. The program scans the keypad rows and columns to detect key presses and displays the corresponding number or character on the LCD. It initializes the LCD, then continuously scans the keypad rows in a loop, using logic to determine the key pressed based on the row and column, and displays the character on the LCD.

Uploaded by

c2ecehod
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
You are on page 1/ 3

EXPT. NO.

06
KEYPAD INTERFACING

Aim: Interface 4x4 Keypad to 8051 Microcontroller and an ALP for key pressed on to LCD.

Apparatus: 1. 8051 Development Board


2. 4x4 Keypad
3. LCD
4. Keil uVision
5. Proload
Program:
ORG 00H
MOV DPTR,#LUT
ACALL LCD
BAK: MOV P0,#0FFH
CLR P0.0
JB P0.4,NX1
MOV A,#0D
ACALL DIS
NX1: JB P0.5,NX2
MOV A,#1D
ACALL DIS
NX2: JB P0.6,NX3
MOV A,#2D
ACALL DIS
NX3: JB P0.7,NX4
MOV A,#3D
ACALL DIS
NX4: SETB P0.0
CLR P0.1
JB P0.4,NX5
MOV A,#4D
ACALL DIS
NX5: JB P0.5,NX6
MOV A,#5D
ACALL DIS
NX6: JB P0.6,NX7
MOV A,#6D
ACALL DIS
NX7: JB P0.7,NX8
MOV A,#7D
ACALL DIS
NX8: SETB P0.1
CLR P0.2
JB P0.4,NX9
MOV A,#8D
ACALL DIS
NX9: JB P0.5,NX10
MOV A,#9D
ACALL DIS
NX10: JB P0.6,NX11
MOV A,#10D
ACALL DIS
NX11: JB P0.7,NX12
MOV A,#11D
ACALL DIS
NX12: SETB P0.2
CLR P0.3
JB P0.4,NX13
MOV A,#12D
ACALL DIS
NX13: JB P0.5,NX14
MOV A,#13D
ACALL DIS
NX14: JB P0.6,NX15
MOV A,#14D
ACALL DIS
NX15: JB P0.7,BAK
MOV A,#15D
ACALL DIS
LJMP BAK
LCD: MOV A,#38H
ACALL CMN
MOV A,#0FH
ACALL CMN
MOV A,#01H
ACALL CMN
MOV A,#06H
ACALL CMN
MOV A,#82H
ACALL CMN
RET
CMN: MOV P1,A
CLR P3.5
CLR P3.4
SETB P3.3
CLR P3.3
ACALL DEY
RET
DIS: MOVC A,@A+DPTR
MOV P1,A
SETB P3.5
CLR P3.4
SETB P3.3
CLR P3.3
ACALL DEY
RET
DEY: CLR P3.3
CLR P3.5
SETB P3.4
MOV P1,#0FFH
SETB P3.3
MOV A,P1
JB ACC.7,DEY
CLR P3.3
CLR P3.3
RET
LUT: DB '1','2','3','A'
DB '4','5','6','B'
DB '7','8','9','C'
DB '*','0','#','D'
END

Output:

You might also like