This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LCD INTARFACING

I AM NEW TO INTARFACING VARIOUS DEVICES TO THE MICROCONTROLLER. I AM USING THE AT89C51 CONTROLLER I AM INTARFACING THE LCD WITH IT AND I AM USING PORT 2 AS THE DATA PORT PORT 0 PINS 5,6&7 CONNECTED RESPECTIVELY TO PIN 4,5&60F THE LCD.I HAVE LOADED THE PROGRAM OF IN CONTROLLER IS CHECKING THE BUSY BIT I.E.G. OF CHECKIG THE BUSY BIT BY POLLING. THE LCD IS NOT DISPLAYING ANY THING. I AUESS IT IS BEING INTIALIZED BUT IT IS NOT COMING BACK FROM THE SUBROUTINE OF POLLING. PLEASE HELP ME AS SOON AS POSSIBLE .

  • Do you think people will read your request IF YOU SCREAM?

  • I tried to read the original post, my eyes tired halfway through

    Erik

  • i find thsi code for you. i try code in 8 bit mode it works. I used Keil v8 compilar.

    yes,,,, i help and not say Please read the manual all times!

    
    ;8 bit LCD routines with check busy flag before sending data, command to LCD
    ;*************************************************************
    LCD     DATA     P1          ;define LCD data port on port 1
    BUSY    BIT      LCD.7       ;define LCD busy flag
    E       BIT      P2.2        ;define LCD enable pin on port 2.2
    RS      BIT      P2.0        ;define LCD register select pin on port 2.0
    RW      BIT      P2.1        ;define LCD read/write pin on port 2.1
    ;*************************************************************
            ORG      00H
    
    LCD_INIT:
            MOV      A,#38H                ;2 line 5x7
            ACALL    COMMAND
            MOV      A,#0CH                ;LCD on cursor on
            ACALL    COMMAND
            MOV      A,#01H                ;clear LCD
            ACALL    COMMAND
            MOV      A,#06H                ;shift cursor right
            ACALL    COMMAND
    DISPLAY:MOV      A,#81H
            ACALL    COMMAND
            MOV      DPTR,#TEST
            ACALL    DISP_STRING
            MOV      A,#0C1H
            ACALL    COMMAND
            MOV      DPTR,#TEST+0EH
            ACALL    DISP_STRING
    HERE:   SJMP     HERE
    ;=============================================================
    COMMAND:
            ACALL    READY                 ;is LCD ready?
            MOV      LCD,A                 ;issue command code
            CLR      RS                    ;RS=0 for command
            CLR      RW                    ;R/W=0 to write to LCD|
            SETB     E                     ;E=1 for H-to-L pulse
            CLR      E                     ;E=0 ,latch in
            RET
    ;=============================================================
    DATA_DISPLAY:
            ACALL    READY                 ;is LCD ready?
            MOV      LCD,A                 ;issue data
            SETB     RS                    ;RS=1 for data
            CLR      RW                    ;R/W=0 to write to LCD
            SETB     E                     ;E=1 for H-to-L pulse
            CLR      E                     ;E=0 ,latch in
            RET
    ;=============================================================
    READY:
            SETB     BUSY                  ;make P1.7 input port
            CLR      RS                    ;RS=0 access command reg
            SETB     RW                    ;R/W=1 read command reg
    ;read command reg and check busy flag
    BACK:
            CLR      E                     ;E=1 for H-to-L pulse
            SETB     E                     ;E=0 H-to-l pulse
            JB       BUSY,BACK             ;stay until busy flag=0
            RET
    ;=============================================================
    DISP_STRING:
            CLR      A                     ;A=0
            MOV      R7,#00H               ;R7=0
    NEXT_CHAR:
            INC      R7                    ;R7+1
            MOVC     A,@A+DPTR
            ACALL    DATA_DISPLAY
            MOV      A,R7
            CJNE     R7,#0EH,NEXT_CHAR
            RET
    ;=============================================================
    TEST:   DB       "8-Bit LCD Test","By 80C51 MCU's"
            END
    
    

  • per westermarck what kind of fool are you????

  • I AM NEW TO INTARFACING VARIOUS DEVICES

    Including a keyboard, so it would seem...

  • SIR MASTER ZEUSTI,

    I DO A CHANGE AND NOW WITH YOUR CODE WORKING PERFECTTY ! THANK TO YOU .

  • As others should state, please check the contrast. Some (at least most of them) use -VEE supply for the contrast. The typical voltage of the contrast ranges from 0V to -9V. At 0V the display is all white and nothing can be read; and @ -9V the display is all black and again nothing can be read. The values in between provide a change in the contrast. You can connect a linear pot (say 10K) between the -VEE of the LCD and -9V of the supply. Adjust the contrast.

  • ZEUISTI

    CAN YOU HELP ME AGAIN?

    I WANT TO SHOW DIFERENT CHARACTERS AND POSSIBLY SOME GRAPHICS.

    HOW CAN I DO IT?

  • How about starting with lower-case ones...?

  • ZEUISTI

    CAN YOU HELP ME AGAIN?

    I WANT TO SHOW DIFERENT CHARACTERS AND POSSIBLY SOME GRAPHICS.

    HOW CAN I DO IT?

    Erik would say: "the deaf leading the blind".

  • yes. i will try to help you.

    this is code to program the characters. be care full! you Must change the DB's.

    ;****************************************************************************
    ;
    ; TABLE OF CHARACTERS. 8 BYTES FOR EACH CHARACTER AND 8 CHARACTERS
    ;
    ;****************************************************************************
    
    CHARS:   DB        1Ah,25h,1Ah,25h,1Ah,25h,1Ah,00h
           DB        25h,1Ah,25h,1Ah,25h,1Ah,25h,00h
             DB        1Ah,25h,1Ah,25h,1Ah,25h,1Ah,00h
              DB        25h,1Ah,25h,1Ah,25h,1Ah,25h,00h
           DB        1Ah,25h,1Ah,25h,1Ah,25h,1Ah,00h
            DB        25h,1Ah,25h,1Ah,25h,1Ah,25h,00h
          DB        1Ah,25h,1Ah,25h,1Ah,25h,1Ah,00h
            DB        25h,1Ah,25h,1Ah,25h,1Ah,25h,00h
    
    ;****************************************************************************
    ;
    ; LOAD CHARACTERS TO DISPLAY
    ;
    ;****************************************************************************
    
    LOAD_CHARS:
    
            MOV        A,#01000000B                ;SAY CG RAM ADDR (0)
            CALL        WRITE_CTRL
    
            MOV        DPTR,#CHARS                ;GO TO START OF DATA
    
            MOV        R2,#64                        ;WRITE 64 BYTES OF DATA
    LOOP1:   CLR        A
            MOVC     A,@A+DPTR
            CALL        WRITE_DATA
            INC        DPTR
    
            DJNZ        R2,LOOP1
            RET
    

    Master Zeusti

    the man whith advice

  • Master Zeusti

    the man whith advice

    Ho, yeah.

  • A MASTER ZEUSTI,

    YOURE CODE WORKS JUST ONLY A LITTLE CHANGE.

    YOU ARE THE MAIN MAN!

    THANK TO YOU AGAIN.