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.

Interfacing Keypad and LCD..

Status
Not open for further replies.

Rushdiey

Junior Member level 2
Joined
Jan 10, 2013
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,419
I got the keypade code..
But how to relate them?
This my keypad code

Code:
EN              EQU     P1.1
RW              EQU     P1.3
RS              EQU     P1.2
DP1             EQU     P3.0

                ORG     00H 
START:          ACALL   DELAY
		MOV 	R5,#28H
                ACALL   COMMAND
                MOV 	R5,#0EH
                ACALL   COMMAND
                MOV 	R5,#01H
                ACALL   COMMAND
                MOV 	R5,#06H
                ACALL   COMMAND
               	MOV 	R5,#80H
              	ACALL   COMMAND
              	;MOV	R5,#7
;LOOP:          ; ACALL 	TULIS
                
                
                
                MOV 	R5,#80H
              	ACALL   COMMAND
		MOV 	R5,#'S'
              	ACALL   TULIS
              	 MOV 	R5,#82H
              	ACALL   COMMAND
		MOV 	R5,#'A'
              	ACALL   TULIS
              	 MOV 	R5,#84H
              	ACALL   COMMAND
		MOV 	R5,#'Y'
              	ACALL   TULIS
              	 MOV 	R5,#86H
              	ACALL   COMMAND
		MOV 	R5,#'A'
              	ACALL   TULIS
              	MOV 	R5,#0C1H
              	ACALL   COMMAND
		MOV 	R5,#'C'
              	ACALL   TULIS
              	;DJNZ    R5,LOOP
;               MOV	R5,#9
;               ACALL 	TULIS
HERE:		SJMP HERE
           
                                                     
                                                                                      
    		MOV DPTR,#0150H
    		;MOV R1,#0
NEXT_CHAR: 	MOV     A,#0
	        MOVC    A,@A+DPTR
	         
 	        JZ      STRING_END
       		 ;ACALL   DELAY
		MOV R5,A
		ACALL   TULIS
                INC     DPTR
                AJMP    NEXT_CHAR
           
        

STRING_END:      SJMP $
                
CLOCK:          SETB    EN
                ACALL   DELAY_INIT
                CLR     EN
                ACALL   DELAY_INIT
                NOP
                RET
                
TULIS:	        MOV 	A,R5
		;ORL	A,#30H
                ANL 	A,#0F0H
                MOV     P1,A
                SETB    RS
                CLR     RW
                ACALL   CLOCK
                MOV 	A,R5
               ;	ORL	A,#30H
                SWAP 	A
                MOV     P1,A
                SETB    RS
                CLR     RW
                ACALL   CLOCK
                RET
                
COMMAND:        MOV 	A,R5
                ANL 	A,#0F0H
                MOV     P1,A
                CLR     RS
                CLR     RW
                ACALL   CLOCK
                MOV 	A,R5
                SWAP 	A
                MOV     P1,A
                CLR     RS
                CLR     RW
                ACALL   CLOCK
                RET

DELAY:          MOV     R7,#0FFH
DEL:            NOP
                NOP
                DJNZ    R7,DEL
                RET

DELAY_INIT:     MOV     R7,#0FFH
DEL1:           NOP
                NOP
                NOP
                NOP
                NOP
                NOP
                NOP
                DJNZ    R7,DEL1
STOP:           RET

                ORG     0150H
TABLE:       DB      ' ',0

                END
 
Last edited by a moderator:

This code seems to be an LCD interface code. I didn't found any segment which will help for keyboard interface....

Check this link... Might help you...
**broken link removed**
 

EN EQU P1.1
RW EQU P1.3
RS EQU P1.2
DP1 EQU P3.0

ORG 00H
START: ACALL DELAY
MOV R5,#28H
ACALL COMMAND
MOV R5,#0EH
ACALL COMMAND
MOV R5,#01H
ACALL COMMAND
MOV R5,#06H
ACALL COMMAND
MOV R5,#80H
ACALL COMMAND
;MOV R5,#9

;DJNZ R5,LOOP


;MOV R5,#82H
;ACALL COMMAND
;MOV R5,#9
;ACALL TULIS
;MOV R5,#0C0H
;ACALL COMMAND
;MOV R4,#'A'
;ACALL HURUF
;LOOP:
MOV P3,#0F0H
SCAN: MOV P3,#0FEH
JB P3.4, NEXT1;0
JNB P3.4, $
MOV R5,#'0'
ACALL TULIS
JMP SCAN
NEXT1: JB P3.5, NEXT2;1
JNB P3.5, $
MOV R5,#'4'
ACALL TULIS
JMP SCAN
NEXT2: JB P3.6, NEXT3;2
JNB P3.6, $
MOV R5,#'8'
ACALL TULIS
JMP SCAN
NEXT3: JB P3.7, NEXT4;3
JNB P3.7, $
MOV R5,#'C'
ACALL TULIS
JMP SCAN
NEXT4: MOV P3,#0FDH
JB P3.4, NEXT11;4
JNB P3.4, $
MOV R5,#'1'
ACALL TULIS
JMP SCAN
NEXT11: JB P3.5, NEXT12;5
JNB P3.5, $
MOV R5,#'5'
ACALL TULIS
JMP SCAN
NEXT12: JB P3.6, NEXT13;6
JNB P3.6, $
MOV R5,#'9'
ACALL TULIS
JMP SCAN
NEXT13: JB P3.7, NEXT14;7
JNB P3.7, $
MOV R5,#'D'
ACALL TULIS
JMP SCAN
NEXT14: MOV P3,#0FBH
JB P3.4, NEXT21;8
JNB P3.4, $
MOV R5,#'2'
ACALL TULIS
JMP SCAN
NEXT21: JB P3.5, NEXT22;9
JNB P3.5, $
MOV R5,#'6'
ACALL TULIS
JMP SCAN
NEXT22: JB P3.6, NEXT23;A
JNB P3.6, $
MOV R5,#'A'
ACALL TULIS
JMP SCAN
NEXT23: JB P3.7, NEXT24;B
JNB P3.7, $
MOV R5,#'E'
ACALL TULIS
JMP SCAN
NEXT24: MOV P3,#0F7H
JB P3.4, NEXT31;C
JNB P3.4, $
MOV R5,#'3'
ACALL TULIS
JMP SCAN
NEXT31: JB P3.5, NEXT32;D
JNB P3.5, $
MOV R5,#'7'
ACALL TULIS
JMP SCAN
NEXT32: JB P3.6, NEXT33;E
JNB P3.6, $
MOV R5,#'B'
ACALL TULIS
JMP SCAN
NEXT33: JB P3.7, SCAN2;F
JNB P3.7, $
MOV R5, #01H
ACALL COMMAND
MOV R5,#'='
ACALL TULIS
SCAN2: JMP SCAN

;DJNZ R5, TEST
;TEST: LJMP LOOP




HERE: SJMP HERE



MOV DPTR,#0150H
;MOV R1,#0
NEXT_CHAR: MOV A,#0
MOVC A,@A+DPTR

JZ STRING_END
;ACALL DELAY
MOV R5,A
ACALL TULIS
;MOV R4,A
;ACALL HURUF
INC DPTR
AJMP NEXT_CHAR



STRING_END: SJMP $

CLOCK: SETB EN
ACALL DELAY_INIT
CLR EN
ACALL DELAY_INIT
NOP
RET

TULIS: MOV A,R5
;ORL A,#30H
;ANL A,#0F0H
MOV P1,A
SETB RS
CLR RW
ACALL CLOCK
MOV A,R5
;ORL A,#30H
;ANL A,#0F0H
SWAP A
MOV P1,A
SETB RS
CLR RW
ACALL CLOCK
RET

;HURUF: MOV A,R4
;ORL A,#30H
;ANL A,#0F0H
;MOV P1,A
;SETB RS
;CLR RW
;ACALL CLOCK
;MOV A,R4
;ORL A,#30H
;ANL A,#0F0H
;SWAP A
;MOV P1,A
;SETB RS
;CLR RW
;ACALL CLOCK
;RET

COMMAND: MOV A,R5
ANL A,#0F0H
MOV P1,A
CLR RS
CLR RW
ACALL CLOCK
MOV A,R5
SWAP A
MOV P1,A
CLR RS
CLR RW
ACALL CLOCK
RET

DELAY: MOV R7,#0FFH
DEL: NOP
NOP
DJNZ R7,DEL
RET

DELAY_INIT: MOV R7,#0FFH
DEL1: NOP
NOP
NOP
NOP
NOP
NOP
NOP
DJNZ R7,DEL1
STOP: RET

ORG 0150H
TABLE: DB '0',0

END

This is my new code..
Now the problem how to make when u press buton 1 it show 1 press 2 time show number..
 

I have seen your code but it is not user friendly.so, 1st check your logic with what you want to display for your key pressed.
 

my problem is.. how tom make table?
 

if u have any dot in program then chech the page number 302, for lcd and 313 for key pad for 4x4 of book "the 8051 micro controller & embedded system using c" writer is muhammand ali mazidi code is in assemble language if u have still problem then i send u working code hex file .
 

if u have any dot in program then chech the page number 302, for lcd and 313 for key pad for 4x4 of book "the 8051 micro controller & embedded system using c" writer is muhammand ali mazidi code is in assemble language if u have still problem then i send u working code hex file .

I hope u can send the hex. Btw, I don't have the book
 

You can search in google with the name of the book. You can get some download link....
 

ok i send u hex file send email id
 

ok i send u hex file send email id

rusydiey@yahoo.com.my

- - - Updated - - -

if u have any dot in program then chech the page number 302, for lcd and 313 for key pad for 4x4 of book "the 8051 micro controller & embedded system using c" writer is muhammand ali mazidi code is in assemble language if u have still problem then i send u working code hex file .

Already found the book.. But also cant solve my problem
 

#include<reg51.h>
#include"lcd.h"

#include"4x4keypad.h"
unsigned char p_w[8];
unsigned char pass_w[8]={"1223"};
unsigned char count=0x00,a,p,add=0x04;

void main()
{

lcd_init();

lcd_string(0x80,"Er. Dalvir");
lcd_string(0xc0,"");
while(1)
{

key_detection();
p_w[count]=data_display[z][y];
lcd_data(p_w[count]);
}
}



this is the program
lcd rs=P2.0
lcd en=p2.1
lcd wr=p2.2

keypad connect to p1 0to3 colum 4to7 row

- - - Updated - - -

#include<reg51.h>
#include"lcd.h"

#include"4x4keypad.h"
unsigned char p_w[8];
unsigned char pass_w[8]={"1223"};
unsigned char count=0x00,a,p,add=0x04;

void main()
{

lcd_init();

lcd_string(0x80,"Er. Dalvir");
lcd_string(0xc0,"");
while(1)
{

key_detection();
p_w[count]=data_display[z][y];
lcd_data(p_w[count]);
}
}



this is the program
lcd rs=P2.0
lcd en=p2.1
lcd wr=p2.2

keypad connect to p1 0to3 colum 4to7 row
 

This is C.. Do U Have Assembly?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top