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
Visit site
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**
 


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.
 

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
 

ok i send u hex file send email id

rusydiey@yahoo.com.my

- - - Updated - - -


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
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…