Electronic – arduino – How to fix Hitachi HD44780 16×2 LCD garbled display in 4 bit mode


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 ?

Best Answer

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.print you'd always call something like this:


void waitVoltage(){  
    // 3v(what we want)/2.5 (reference) x1024/2=614  
    //we read VSS/2 on port 11, we want more than 2.5v to write on the lcd