Custom User Module for Using 16x4 LCD with PSoC® Designer™ 5.4 - KBA210682

Version: **

 

Question:

With PSoC Designer 5.4, The LCD user module is developed for a 20x4 LCD display based on the Hitachi HD44780 driver. Why it is different for 16x4 LCD and How to support 16x4 LCD with PSoC Designer ?

 

Answer:

The LCD user module with PSoC designer is developed for a 20x4 LCD display based on the Hitachi HD44780 driver. There are differences in DDRAM addresses for 16x4 and 20x4 displays. The base addresses for the characters for the four rows in a 20x4 display are 0, 64, 20, and 84. The base addresses for the characters for the 4 rows in a 16x4 display are 0, 64, 16, and 80.

As PSoC uses the address set 0, 64, 20, and 84, the characters are displayed at an offset of four for Rows 2 and 3. To get the 16x4 LCD to work fine with the LCD user module, the base addresses for Rows 2 and 3 should be made as 16 and 80. So the workaround is to change LCD.asm file. Search for lines 169 and 170 in LCD.asm

LCD_ROW3_OFFSET: equ 94h

LCD_ROW4_OFFSET: equ D4h

Change them to

LCD_ROW3_OFFSET: equ 90h

LCD_ROW4_OFFSET: equ D0h

A custom User Module entertaining these changes is attached with this KB article. We can easily import into the PSoC Designer Project and use it in any of the projects.