PWM for LCD contrast.
FORD
Posts: 221
Hi All,
I read on the forum somewhere about using PWM and a counter to adjust the contrast on an LCD, using a simple resistor and cap.
I have no problems with the hardware side, and have searched everywhere for an example for the counter setup, but cant find anything that makes it clear enough for me in these early days of using a prop.
Can anyone point me to some sample code to provide an adjustable PWM on i/o pin 13, using CTRA please ?
I would like to be able to adjust a variable that will simply change the PWM as a square wave, nothing fancy required (I dont think anyway).
Any help would be appreciated, I have tried to help myself but I get bogged down with the technicalities in the manual.
Cheers,
Chris
I read on the forum somewhere about using PWM and a counter to adjust the contrast on an LCD, using a simple resistor and cap.
I have no problems with the hardware side, and have searched everywhere for an example for the counter setup, but cant find anything that makes it clear enough for me in these early days of using a prop.
Can anyone point me to some sample code to provide an adjustable PWM on i/o pin 13, using CTRA please ?
I would like to be able to adjust a variable that will simply change the PWM as a square wave, nothing fancy required (I dont think anyway).
Any help would be appreciated, I have tried to help myself but I get bogged down with the technicalities in the manual.
Cheers,
Chris
Comments
Hi Chris,
Just use a 220R resistor from the pin to the LCD and a 0.1uF cap to ground on the LCD. This is the bit of code you need and this one assumes it's a 7-bit value being passed to it.
very much appreciated, and I'm sure many others will benefit from this as well.
cheers,
Chris