16x2 LCD with 16F877A

Little DJ

Well-known member
  • Nov 29, 2010
    1,014
    311
    83
    Panadura


    In this exercise lets look at how can we interface a LCD display with 16F877A PIC microcontroller.

    The mikroC PRO for PIC provides a library for communication with LCDs (with HD44780 compliant controllers) through the 4-bit interface.

    HD44780 Pinout

    1. Vss (Ground)
    2. VCC (5V)
    3. Contrast (use a potentiometer for variable contrast, or just connect to GND)
    4. Register Select (RS), 0 = command write, 1 = data write
    5. Read/Write (R/W), 0 = write to display, 1 = read from display
    6. Enable (EN) - used to clock in data
    7. DB0 (not used in 4-bit mode) - LSb
    8. DB1 (not used in 4-bit mode)
    9. DB2 (not used in 4-bit mode)
    10. DB3 (not used in 4-bit mode)
    11. DB4 - LSb in 4-bit mode
    12. DB5
    13. DB6
    14. DB7 - MSb
    15. Backlight + (5V)
    16. Backlight - (GND)

    4-bit and 8-bit modes

    An HD44780 LCD can be operated in two different modes: 4-bit mode and 8-bit mode. In 8-bit mode, pins 7-14 of the LCD are connected to eight I/O pins on the microcontroller; while in 4-bit mode, pins 11-14 on the LCD are connected to four I/O pins on the microcontroller. The advantage to operating in 8-bit mode is that the programming is a bit simpler and data can be updated more quickly. The obvious reason to operate in 4-bit mode is to save four I/O pins on the PIC microcontroller.

    Circuit Diagram for 16x2 LCD

    16x2+LCD.png


    Complete Circuit Diagram with PIC Microcontroller

    16x2+LCD.JPG





    To get MikroC Code & PROTUES Design: Click Here



     
    Last edited: