William Roth - 2016-05-24

Correcting LCD Initialization Problems

I recently set up a 4X20 LCD (White on Blue) Display using 4 bit mode (LCD_IO 4). This is a type of display where the backlight must be on in order to see the text. So to eliminate an LCD backlight transistor, I decide to connect the backlight directly to VDD so that thebBacklight is always on. Vdd is supplied to the breadboard by a stable high current capable power supply. A 100uf Bulk/Filter capacitor is placed near the VDD line for the LCD.

This seemed to work ok at first. But I noticed that when I switched VDD off to the bread board and then quickly switched it back on that the LCD would sometimes not re-initalize. The rest of the code ran fine. Also sometimes after programming, the LCD would not initalize, yet the rest of the code would run OK.

Leaving the power off for 2 seconds before turning it back on seemed to correct the problem.

This problem is related to the current drawn by the LCD backlight while the LCD initalization routine is running.

Solution 1: (Not preferred) Add a 1 second delay at the beginning of the LCD initalization routine in the LCD.H driver library. This prevents the initalization routine from running until the backlight is fully on and stable. However, modifying this lowlevel driver is not generaly recommended.

Solution 2: (Preferred) Use the transistor! The LCD.H driver keeps the backlight Off during initalization to prevent initalization errors. However, with this type of display your source code must enable the backlight before printing any characters or you cannot see them. See Command "LCDBacklight" in the Help File.

It may be important to note here that a Pickit2 or Pickit3 may not be able to supply enough voltage/current to drive a PIC and 5V LCD with a backlight when using a Laptop/PC USB Port. I highly recommend using a powered USB Hub when powering devices via Pickit. Even then the current should not excede ~100 ma. Even better ( in most cases) is to use an external supply for powering the breadboard/PIC/LCD.

The latest GCB help file shows how to connect and control the backlight on an LDC display using a general purpose NPN transistor.

William