HD44780 Compatible LCD Character Display Driver



Most LCD Character displays are designed to be HD44780 compatible. This generic driver provides control of many different variants of these screens and operates in 4 bit mode to reduce the pins required from the microcontroller.

This is an Embedded-Code.com Free Driver Project !

Our Free Driver Projects are provided as a simple bare bones driver which you may download and use for free! Typically they will be the driver files taken from a product design project we have worked on and are provided to help other programmers get up and running quickly and easily when using the same or a similar device in their project. Free Driver projects have often been designed with specific usage of the target device in mind and the driver will not necessarily provide functionality that utilises all of the device capabilities.

These projects are typically not supplied with separate documentation as the code is well commented. Please look through the header file and source code for full details of the drivers functionality.

This driver has been tested by Embedded-Code.com. Please note that we do not provide technical support for free driver projects.

This Free Driver project is provided with a Commercial Use Licence - please read the 'Free Driver Project Source Code Licence Agreement' section of our Licence page before downloading.


This driver provides the following features:

  • Compatible with most standard 1, 2 or 4 line displays with up to 40 characters
  • Reads the busy flag back from the LCD screen so that the display may be updated as quickly as possible
  • Functions in the background checking for being able to write the next character every time its main function is called, to avoid code execution stall when using slow displays.
  • Supports left, middle and right aligned text.
  • Display from constant program memory or variable ram memory.
  • Only store as many characters as required in program memory – Null character determines end of lines text an avoids wasted program memory space.
  • A simple driver that just drops in to your project and makes your life easier

This driver provides the following functions:

INITIALISE LCD
void lcd_initialise (void)
Call on power-up

UPDATE LCD DISPLAY
void lcd_update_display (void)
Call as part of your main loop. This function outputs characters to the display and exits if the display is currently busy to avoid application stall with slow displays.

WRITE LINE OF LCD DISPLAY (Versions for constant and variable strings)
void lcd_display_const_string (BYTE line_number, BYTE alignment, CONSTANT BYTE *text_line)
void lcd_display_variable_string (BYTE line_number, BYTE alignment, BYTE *text_line)

Call these functions to display a line of text
line_number 0 = top line
alignment LCD_ALIGN_LEFT, LCD_ALIGN_CENTER or, LCD_ALIGN_RIGHT
text_line Null terminated string

IS SCREEN BUSY
BYTE lcd_is_screen_busy (void)
Returns 1 if screen is still busy from last operation, 0 if not

SEND HIGH AND LOW NIBBLES OF W TO LCD DATA REG
void lcd_write_data_byte (BYTE data)

SEND HIGH AND LOW NIBBLES TO LCD CTRL REG
void lcd_write_control_byte (BYTE data)

SEND HI NIBBLE OF W TO LCD CTRL REG
void lcd_write_ctrl_hi_nibble (BYTE data)

SEND LO NIBBLE OF W TO LCD CTRL REG
void lcd_write_ctrl_lo_nibble (BYTE data)

Please view the sample source code files for full information regarding the driver.


This source code product is written in C and has been designed to be used with any ANSI compliant C compiler on any platform. Direct compatibility has been tested with the compilers and processors / microcontrollers listed below. Using the driver with other ANSI compliant C compilers and devices should not present significant problems.
Tested with the Microchip C18 MPLAB C Compiler for PIC18 family of 8 bit microcontrollers. Free version of the compiler available from Microchip.


Download our generic header file
Download driver .h header file
Download driver .c code file
Download HD44780 datasheet


Please ensure you read and understand the 'Free Driver Project Source Code Licence Agreement' section of our Licence page before downloading these project files.