Articles added in Mathematics Lab | Cyber Lab is now open | Astronomy Lab is now open | VLSI Lab is now open | 120 SEO Tips article published | More exciting articles coming soon!




LCD Interfacing with 8051

  • The LED 7-segment display consumes more power which makes it unsuitable for battery operated devices. On the contrary, LCD display consumes less power which makes it suitable for battery operated devices. Example- calculator, mobile.

  • LCD is more flexible in terms of size, shape and has ability to display numbers, characters, words, letter and graphics with simple interface.

  • LED displays require refreshing circuit which is done by microcontroller to keep the display. Whereas LCD has its own refreshing circuit which reduces the burden of microcontroller.

  • The LCD displays are classified and designated depending upon no. of lines and no. of characters to be displayed on each line such as:

    • 1. 1x16 character LCD
      2. 2x16 character LCD
      3. 2x20 character LCD
      4. 2x40 character LCD
      5. 4x40 character LCD etc.
  • The interfacing of 2x20 character LCD with Microcontroller 8051 is shown n figure.

  • The following are the role of different pins of LCD:-

  • 1. VCC,VSS and VEE:
    VCC and VSS provide the +5V and Ground to the LCD and VEE is used for contrast adjustment of LCD.

    2. RS(Register Select):
    There are two important registers inside LCD viz.
      i. Instruction command code register
      ii.Data register

    The RS control signal is used to select one of the register of LCD. When RS=’1’ then data register is selected and when RS='0' then instruction command code register is selected.

    3. R/W(Read/Write):

    It allows user to read/write command or data to LCD. When this pin is at logic’1’, then it performs write command or data and when it is at logic'1' then it reads status information from LCD.

    4. E(Enable):

    It is used as latch. When a high to low signal is applied to this pin and then the latch get enabled and the data/command received is stored in the LCD.

    5. D0-D7:

    It is an 8-bit data bus which is used to send data/command to LCD to displaying various numbers/characters etc.

  • The following are the command codes for LCD which can be sent to instruction register to perform a particular operation.
  • Interfacing LCD with 8051

    Program

    LABEL

    OPCODE

    OPERAND

    COMMENT

     

     

     

     

     

    ORG

    0000H

     

     

    MOV

    A,#38H

     

     

    ACALL

    COMMAND

     

     

    ACALL

    DELAY

     

     

    MOV

    A,#0EH

     

     

    ACALL

    COMMAND

     

     

    ACALL

    DELAY

     

     

    MOV

    A,#01H

     

     

    ACALL

    COMMAND

     

     

    ACALL

    DELAY

     

     

    MOV

    A,#06H

     

     

    ACALL

    COMMAND

     

     

    ACALL

    DELAY

     

     

    MOV

    A,#84H

     

     

    ACALL

    COMMAND

     

     

    ACALL

    DELAY

     

     

    MOV

    A,#’N’

     

     

    ACALL

    DISPLAY

     

     

    ACALL

    DELAY

     

     

    MOV

    A,#’O’

     

     

    ACALL

    DISPLAY

     

     

    ACALL

    DELAY

     

    AGAIN:

    SJMP

    AGAIN

     

     

     

     

     

    COMMAND:

    MOV

    P1,A

     

     

    CLR

    P2.0

     

     

    CLR

    P2.1

     

     

    SETB

    P2.2

     

     

    ACALL

    DELAY

     

     

    CLR

    P2.2

     

     

    RET

     

     

     

     

     

     

    DISPLAY:

    MOV

    P1,A

     

     

    SETB

    P2.0

     

     

    CLR

    P2.1

     

     

    SETB

    P2.2

     

     

    ACALL

    DELAY

     

     

    CLR

    P2.2

     

     

    RET

     

     

     

     

     

     

    DELAY:

    MOV

    R3,#50

     

    L2:

    MOV

    R4,#255

     

    L1:

    DJNZ

    R4,L1

     

     

    DJNZ

    R3,L2

     

     

    RET

     

     

     

    END

     

     

     

     

     

     



    Interfacing Diagram

    Interfacing LCD with 8051






    CACKLE comment system





    Programming Resources
    Computer Networking Fundamentals Android Application