KB 04: Character LCD displays incorrect characters or missing characters

Typically, we connect a HD44780 based character LCD module to the embedded system to display important information during development or provide information to the user. Some LCD modules have problems when you send character to the module, it will display incorrect characters, or some characters on the screen will be lost.

For example:

LCD_Position(0,0);
LCD_PrintString("Hello World!");
LCD_Position(1,0);
LCD_PrintString("123456789");

The LCD module displays the message as shown below:

lcd error 01

On the screen, you can find two wrong letters: the letter "r" is incorrect, and the number "5" is missed.

The reason is that some LCD modules have timing problems. The solution is to modify the source code to add more delay.

  1. Change the CPU  frequency by following the KB 03: Setting CPU Frequency of PSoC 5LP in PSoC Creator
  2. Modify the Stack and Heap size.
  3. You may need to enable the float formatting supported by following the KB 02: Floating Point Problem in PSoC Creator.
  4. Modify the source code
    • In the Workspace Explorer Catalog, expand the Generated_Source ➤ PSoC5LCD.
    • Double click on LCD.c file to open the source code.
    • Search the function void LCD_IsReady(void), add a CyDelay(10) function at the end of the function.
      LCD.c delay s
    • Clean and build the design