PDA

View Full Version : Easy LCD Contrast


Melanie
- 30th July 2003, 10:10
Here's a useful and very simple way of controlling the contrast on an LCD with just two Resistors and a line of code. If the PIC in your project has an unused available PWM channel (eg 16F628, F876 etc etc), then this will enable you to control your LCD's contrast over it's usable range and at absolute minimum cost.

HPWM 1,Contrast,1000

Where Contrast is a byte variable in the range 0-125. Steps of 25 seem to be adequate (ie Contrast=0, 25, 50, 75,100 or 125) where zero is maximum and 125 is minimum. Stepping above 125 is pointless as your display will disappear into obscurity.

The value for Resistors R1 and R2 I've set at 1K5, mainly because I've been told we have almost 2 million of that value in stock and please can I find a way of getting rid of them. Decreasing R2 to say 680R will increase the bottom-end contrast, but the software variable Contrast might need larger steps (say steps of 40) and increased span (eg 0-240).

You really don't get much cheaper or simpler than this...

Melanie

Art
- 8th August 2003, 19:51
Thanx Melanie,
I will be able to try that out in my current project which is a
2x16 LCD. I'm not worried about a few dollars/cents for a trimpot,
but any saving of space on any PCB is a blessing, and so is
software control over hardware :)
Art.

Byte_Butcher
- 30th November 2009, 18:58
Well it's just amazing how simple and easy that is!
Works Great!



steve

rmteo
- 30th November 2009, 19:18
Will this work with a graphic LCD?

Melanie
- 30th November 2009, 20:10
If your LCD's Contrast is adjusted the same way as in a standard LCD, then yes. Just try it - you have nothing to lose but a few minutes out of your life.

There's a lot of goodies buried in this forum, you just have to dig around a little.

Good to have your vote of confidence Steve. *smiles*

rmteo
- 30th November 2009, 23:11
OK, thanks.