Summary of Interface a HD44780 Character LCD with a PIC Microcontroller
An HD44780 character LCD is a text-only display used in many embedded devices. Common sizes include 8x1, 16x2, 20x4 and 40x4 (which uses two controllers). Character LCDs use a 14-pin interface (16 pins with backlight) and may include various backlight types. The article shows interfacing an HD44780 LCD to a PIC16F628A microcontroller in 4-bit mode using mikroC, connecting LCD data lines D4–D7 to RB4–RB7 and RS/EN to RA0/RA1, and reminds to disable PORTA comparator functions when using RA0–RA3 as digital I/O.
Parts used in the Test LCD in 4-bit mode:
- HD44780 character LCD (example sizes: 8x1, 16x2, 20x4, 40x4)
- PIC16F628A microcontroller
- Connection wires
- Power supply for MCU and LCD
- Backlight (optional: LED, fluorescent, or electroluminescent)
- mikroC compiler (software)
- Resistors/potentiometer for contrast (typical for LCD)
Introduction
An HD44780 Character LCD is a liquid crystal display (LCD) display device designed for interfacing with embedded systems. These screens come in a variety of configurations including 8×1, which is one row of eight characters, 16×2, and 20×4. The most commonly manufactured configuration is 40×4 characters, which requires two individually addressable HD44780 controllers with expansion chips as the HD44780 can only address up to 80 characters.

I am going to show you how to interface such a LCD to a PIC microcontroller (PIC16F628A). The programming for PIC will be done in mikroC (a C compiler for PIC from mikroelektronika).
Note: Never forget to disable the comparator functions on PORTA.0, 1, 2, 3 pins if you are going to use those pins as digital I/O.
Test LCD in 4-bit mode
* Description:
This code demonstrates how to display test message on a LCD which
is connected to PIC16F628A through PORTB. D4-D7 pins of LCD are
connected to RB4-RB7, whereas RS and EN pins connected to RA0 and RA1
- How are the LCD data pins connected to the PIC16F628A in this project?
LCD data pins D4-D7 are connected to PIC PORTB pins RB4-RB7. - Where are RS and EN pins of the LCD connected?
RS and EN are connected to PIC PORTA pins RA0 and RA1 respectively. - Which MCU pins require disabling comparator functions when used as digital I/O?
Disable the comparator functions on PORTA pins RA0, RA1, RA2, and RA3 when using them as digital I/O. - What microcontroller is used in the example interfacing?
The example uses the PIC16F628A microcontroller. - What compiler is used for programming the PIC in this project?
Programming is done using the mikroC compiler from mikroelektronika. - What interface mode is demonstrated for the LCD?
The code demonstrates interfacing the LCD in 4-bit mode. - How many pins does a character LCD use and how many if it has a backlight?
Character LCDs use a standard 14-pin interface and use 16 pins if they include a backlight. - Can HD44780 character LCDs display graphics?
No, these LCDs are limited to text only.
