HAL library 15- HD44780 for STM32Fxxx

HD44780 LCDs are still very popular devices in embedded project so I think you can’t without simple library for them. I’ve port my old library to HAL based libraries for these LCDs.

Library

Read more about new HAL libraries

Features

  • 4-bits operation mode
  • Minimum GPIOs used (6)
  • Supports different LCD sizes
  • Supports up to 8 custom characters
  • Enable/disable cursor blinking
  • Show/hide cursor
  • Shift content in ram left/right
  • Connection pins to board are user selectable
  • Automatically jumps to new line when you reach max X on LCD
  • Strings with \n, \r or \n\r
    • With \n in string LCD jumps to lower line, but X position stays the same
    • With \r in string LCD jumps to the beginning of the line
    • With \n\r in string LCD jumps to the beginning of a new line

Dependencies

  • HAL
    • STM32Fxxx HAL
    • defines.h
    • TM GPIO
    • TM DELAY

Default pinout

LCD STM32Fxxx DESCRIPTION
GND GND Ground
VCC +5V Power supply for LCD
V0 Potentiometer Contrast voltage. Connect to potentiometer
RS PB2 Register select, can be overwritten in your project’s defines.h file
RW GND Read/write
E PB7 Enable pin, can be overwritten in your project’s defines.h file
D0 Data 0 – doesn’t care
D1 Data 1 – doesn’t care
D2 Data 2 – doesn’t care
D3 Data 3 – doesn’t  care
D4 PC12 Data 4, can be overwritten in your project’s defines.h file
D5 PC13 Data 5, can be overwritten in your project’s defines.h file
D6 PB12 Data 6, can be overwritten in your project’s defines.h file
D7 PB13 Data 7, can be overwritten in your project’s defines.h file
A +3V3 Backlight positive power
K GND Ground for backlight

Custom settings

In case, you need to change any pin for your end project, you can open defines.h file and edit settings you need from library.

Functions and enumerations

Example

Project is available on Github, download all libraries below.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!