lcd interfacing

Thread Starter

saaiim

Joined Sep 13, 2015
1
I have problem interfacing lcd and keypad with 89s52 Microcontroller
i have problem interfacing lcd and keypad with 89s52 Microcontroller
it display 1234567 but not displaying ABCD

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
Moderators note: Pleas use code tags for pieces of code​
 
Last edited by a moderator:

shteii01

Joined Feb 19, 2010
4,644
No comments? Really? Do you think anyone is stupid enough to try to figure out your program for you? You want help? Provide eFing documentation!
 

djsfantasi

Joined Apr 11, 2010
9,163
Sorry it's taken me so long to reply. I thought I'd check in. I estimate that I'm about 2% through understanding your code. But I had to stop because I got a headache.

Lol. Nothing personal, but it really is unrealistic to expect someone to go through your code when it is undocumented and the values therein are literals. Not all of us program in assembly
 
Top