It often happens that a HD44780 16×2 LCD shows garbled characters during usage. Most help on the web advises for using snubbing techniques to prevent voltage noise such as induction spike. I've done all that but the problem still persists. What can I do ?
Electronic – arduino – How to fix Hitachi HD44780 16×2 LCD garbled display in 4 bit mode
- Electronic – arduino – Debugging a 16×2 LCD Display on an Arduino
- Electronic – How does the HD44780 LCD work at the low level
- Interfacing pic184f450 with 16X2 lcd in four bit mode
- Electrical – HD44780 LCD – proper addressing for overseas 16×4 line display
- Electronic – arduino – Reading info from an LCD display
This problem occurs in 4 bit mode, the LCD screen misses a data nibble (a character is made of two 4bits nibbles) and then all subsequent characters are offset by 4bit. You can check that this is your problem by checking that the garbage displayed is always repeated for a known string that is supposed to be shown, for example "Stop" will always show "7Fπ...".
This can occur for several reasons but the main one in my case was low power on the MCU controlling the display. The MCU can still work on lower voltage but when it sets the "EN" (enable) pin of the LCD to HIGH, if it's below the min value for that LCD (2.2V for example ) then the 4bit nibble wont be recorded when the "EN" is set to low again making the display garbled until this error happens again and the display is restored.
In order to fix this, it's best for the MCU to wait until it's supply voltage returns to a value above the min value of the LCD min input HIGH voltage plus a safety margin. For example on MSP430 energia or arduino before calling
lcd.printyou'd always call something like this: