Library 16- Interfacing HD44780 LCD controller with STM32F4

HD44780 LCD on STM32F4xx16th library is here. We will interfacing HD44780 (and its compatible) driver for alpha-numeric LCDs. Library supports up to 20 x 4 LCD size. It was tested with 20 x 4 (on picture) and with 16 x 2.

HD44780 Library

Features

  • 4bit 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

Library dependencies

  • CMSIS
    • STM32F4xx
    • STM32F4xx RCC
    • STM32F4xx GPIO
  • TM
    • TM DELAY
    • TM GPIO
    • defines.h
LCD STM32F4xx 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

If you need to change your pins, open defines.h files, add lines below and edit them.

Functions and enumerations

All possible functions are listed below.

Example

Project is available on Github, download library 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!