/HD44780_I2C

LCD Display Module with I2C Expander IC

Primary LanguageCMakeMIT LicenseMIT

HD44780_I2C

STM32 LL(Low Layer) library for I2C LCD. Works for both 16x2 LCD and 20x4 LCD etc.

Features

  • Small code footprint
  • Supports progress bar
  • Display printf function
  • No HAL dependencies

LCD 16x2

image

LCD 20x4

image

Add as CPM project dependency

How to add CPM to the project, check the link

CPMAddPackage(
        NAME HD44780_I2C
        GITHUB_REPOSITORY ximtech/HD44780_I2C
        GIT_TAG origin/main)

Project configuration

  1. Start project with STM32CubeMX:
  2. Select: Project Manager -> Advanced Settings -> I2C -> LL
  3. Generate Code
  4. Add sources to project:
add_subdirectory(${STM32_CORE_SOURCE_DIR}/I2C/Polling)  # add I2C dependency

include_directories(${includes} 
        ${HD44780_LCD_I2C_DIRECTORY})   # source directories

file(GLOB_RECURSE SOURCES ${sources} 
        ${HD44780_LCD_I2C_SOURCES})    # source files
  1. Then Build -> Clean -> Rebuild Project

Wiring

  • PCF8574 port extender pinout:\
  • image
  • image

Usage

In HD44780_LCD_I2C.h default defines. Override them in main.h if needed

#define HD44780_LCD_COL_COUNT 20
#define HD44780_LCD_ROW_COUNT 4
#define HD44780_LCD_I2C_DEVICE_ADDRESS 0x4e // default PCF8574 address
  • If address differs, use scan mode: example
  • Usage example: link