Quote Originally Posted by lerameur View Post
still get some very dim light back light.
That dim backlight is the result of the Digital inputs bleeding thru the ESD protection diodes on the HD44780, and providing a voltage on the VDD to the LCD. Even though the switch is Open. This will also power the LCD itself. (to some extent)

If you remove power to the LCD, you must also remove the digital levels from the inputs.

If you have an extra pin on the PIC, you can use it to detect when the switch is turned off. Then set all LCD data,RS,E outputs to High-Z (input).

When it senses that power has been restored, it can then set 'FLAGS = 0' to force an Initialization again. You only want to do that once per Power-up of the LCD.

But frankly, it would be better to control the LCD's power with the PIC, instead of a switch. A single transitor on an output PIN will do the job.

A pushbutton can be used to turn on the LCD, then after a period of time, the PIC can turn it off again by itself. Then, by having this control, it knows exactly when it needs to turn off the Digital lines too.

HTH,