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.

i have problem interfacing lcd and keypad with 89s52 Microcontroller

Status
Not open for further replies.

saaiim

Newbie level 3
Joined
Apr 19, 2013
Messages
3
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,302
i have problem interfacing lcd and keypad with 89s52 Microcontroller
it display 1234567 but not displaying ABCD
my progam is: help me plz its an urgent

Code:
 rs equ P3.5
	   rw equ P3.4
	   en equ P3.3   
           ORG 00H
    BACK:    MOV R7,#0H
             MOV A,#38H
             ACALL COMNWRT
             ACALL DELAY1
             MOV A ,#0EH
             ACALL COMNWRT
             ACALL DELAY1
             MOV A,#01
             ACALL COMNWRT
             ACALL DELAY1
             MOV A,#06
             ACALL COMNWRT
             ACALL DELAY1
             MOV A,#80H
             ACALL COMNWRT
             ACALL DELAY1 
            MOV P2,#0FFH
     K1:    MOV P0,#0H
           	MOV A,P2
           	ANL A,#00001111B
           	CJNE A,#00001111B,K1
           	 
     K2:	ACALL DELAY
            MOV A,P2
            ANL A,#00001111B
            CJNE A,#00001111B,OVER
            
            SJMP K2
    OVER:   ACALL DELAY
            MOV A,P2
            ANL A,#00001111B
            CJNE A,#00001111B,OVER1
            
            SJMP K2
    OVER1:  MOV P0,#11111110B
            MOV A,P2
            ANL A,#00001111B
            CJNE A,#00001111B,ROW_0
            MOV P0,#11111101B
            MOV A,P2
            ANL A,#00001111B
            CJNE A,#00001111B,ROW_1
            MOV P0,#11111011B
            MOV A,P2
            ANL A,#00001111B
            CJNE A,#00001111B,ROW_2
            MOV P0,#11110111B
            MOV A,P2
            ANL A,#00001111B
            CJNE A,#00001111B,ROW_3
           
            LJMP K2
    ROW_0:  MOV DPTR,#KCODE0
            SJMP FIND
    ROW_1:  MOV DPTR,#KCODE1
            SJMP FIND
    ROW_2:  MOV DPTR,#KCODE2
            SJMP FIND
    ROW_3:  MOV DPTR,#KCODE3
            SJMP FIND 
    FIND:    
            RRC A
            JNC MATCH
            INC DPTR
            SJMP FIND
     MATCH: CLR A
            MOVC A,@A+DPTR
            MOV P1,A
            CALL DATA1
            INC R7
            CJNE R7,#0FH,K1
            MOV A,#01H
             ACALL COMNWRT
             ACALL DELAY1  
            LJMP BACK
    DELAY:  
            MOV R3,#255
    HERE2:  MOV R4,#120
    HERE:   DJNZ R4,HERE
            DJNZ R3,HERE2
            RET
   DELAY1:  
             MOV R3,#255
    HERE1:   DJNZ R3,HERE1
             RET          
   COMNWRT: 
             MOV P1,A   
             CLR P3.5
             CLR P3.4
             SETB P3.3
             ACALL DELAY
             CLR P3.3
             RET 
   DATA1:       
             SETB P3.5
             CLR P3.4
             SETB P3.3
             ACALL DELAY
             CLR P3.3
             RET
     KCODE0: DB '1','2','3','A'
     KCODE1: DB '4','5','6','B'
     KCODE2: DB '7','8','9','C'
     KCODE3: DB '*','0','#','D'
	 END
 
Last edited by a moderator:

Hi,

You did not show circuit diagram.
are you sure it is the code?

What happens to: '*','0','#','D' ?

Klaus
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top