Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to interface 8051 with keybad

Status
Not open for further replies.
mm74c922

This is a classical example.

Half of the port pins (P10~P13) are used to strobe the keyboard, that is, you drive with the program these lines LOW one at a time, periodically.
Then, as the line is low, you read the port and see if any of the P14~P17 lines is LOW. If so, then one switch is closed. You determine which one by knowing which line was driven LOW and which input line was found LOW.

For example, if P10 is LOW and you find that P15 is LOW, then switch S5 is closed.

If you have fewer keys, you can use fewer lines. A 12-key keypad for example (phone keys) would need 4x3 lines, so you save one port I/O. It could be important, for example the timer input.

The resistors are not absolutely necessary, but they can speed up the keys.

Good luck!
 

you can get this examplesfrom the book " The 8051 ...". This book you can get from 'EDA & Electronics Related E-Book links' room.

good luck.
 

Study 8051 microcontroller by Mckenzie chap no. 10. It explains interfacing
 

Hi

I have a 3x4 keypad and I have tested it with meter to determine the column and row.

I have found that from first to third pin represents column 1 to 3 while forth to sixth pins are for row 1 to 3. Now I want to interface it with my 8051 chip but How earth can I connect 3 pull-up resistor on columns?

I would love to hear your suggestion

Maverick Max
 

see the following links
**broken link removed**
**broken link removed**
**broken link removed**

this might give u some idea. Implement same logic for 8051

Bibin John
www.bibinjohn.tk
 

Use MM74C922 for keypad dedicated 4x3 matrix
 

interfacing keypad with the controller is not a problem
the best book on this is 8051 by M.A.Mazidi
 

yes......i agree with sibtain
go to page 261 of mazidi

here u will find all d details of what actually is done to interface d keypad, how d status of d keys is checked , so on and so forth
 

Unfortunately I don't have that book. Unless you have it as e-book

MM
 

SCAN:
MOV R3,#1FH
LOOP8:
LCALL GET_KEY
JNC SCAN
DJNZ R3,LOOP8
PUSH ACC
LOOP2:
MOV R3,#1FH
LOOP4:
LCALL GET_KEY
JC LOOP2
DJNZ R3,LOOP4
POP ACC
RET




GET_KEY:
MOV A,#0FEH
MOV R6,#04H
LOOP5:
MOV P2,A
MOV R7,A
MOV A,P0
ANL A,#0FH
CJNE A,#0FH,LOOP9
MOV A,R7
RL A
DJNZ R6,LOOP5
CLR C
SJMP LOOP10
LOOP9:
MOV R7,A
MOV A,#04H
CLR C
SUBB A,R6
MOV R6,A
MOV A,R7
NOP
MOV R5,#04H
LOOP6:
RRC A
JNC LOOP7
INC R6
INC R6
INC R6
INC R6
DJNZ R5,LOOP6
LOOP7:
SETB C
MOV A,R6
LOOP10:
RET



LOOKUP:
MOV R2,A
MOV DPTR,#TABLE
LABEL_1:
CLR A
MOVC A,@A+DPTR
CJNE A,02,LABEL_2
MOV A,DPL
ADD A,#10H
MOV DPL,A
CLR A
MOVC A,@A+DPTR
RET
LABEL_2:
INC DPTR
MOV A,R2
LJMP LABEL_1

TABLE:
DB 0x00,0x04,0x08,0x01,0x05,0x09,0x02,0x06,0x0a,0x03,0x07,0x0b,0x0c,0x00,0x00,0x00,0x0a,0x00,0x0b,0x07,0x08,0x09,0x04,0x05,0x06,0x01,0x02,0x03,0x0c,0x00
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top