Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
Joined: 12/06/2011 Location: New ZealandPosts: 711
Posted: 11:42pm 18 Nov 2014
Copy link to clipboard
Print this post
Sure
1K5 to the pic and 470R to Gnd
Jman
viscomjim Guru
Joined: 08/01/2014 Location: United StatesPosts: 925
Posted: 11:54pm 18 Nov 2014
Copy link to clipboard
Print this post
Thanks!!
paceman Guru
Joined: 07/10/2011 Location: AustraliaPosts: 1328
Posted: 01:03am 19 Nov 2014
Copy link to clipboard
Print this post
Hi Jman,
That's pretty neat. I completely missed that thread back in Feb (fishing in Tasmania) so I did the standard pot for contrast control, 20K in this case across 5v (had 5v available anyway) on my UV exposure timer project. I'll definitely keep it in mind for future.
Jim, I'm using a 20K pot connected across 5v/Gnd and wiper to the LCD's contrast control (i.e. V0, pin 3) - works well. I used 20K because using the 5v, the correct contrast was right up towards the top of the 10K pot that I tried originally.
I've got the backlight control from the PWM pin via 1K to the base of a BC337 NPN transistor (what I had available) with the collector going to the LCD backlight cathode (LCD pin 16) and emitter to Gnd via a 0.5K pot. The latter is to set the backlight brightness current for each PWM "ON" pulse. I set it such that it's about the right brightness at 60% duty cycle. The code I use for control is:
sub brightness
lcd 2,c20,""
if keycode = 11 then dutycycle = dutycycle + 10
if keycode = 10 then dutycycle = dutycycle - 10
if dutycycle < 0 then dutycycle = 0
if dutycycle > 100 then
dutycycle = 100
lcd 2,1, " MAXIMUM BRIGHTNESS "
endif
pwm 2,50,dutycycle
keycode = 99
end sub
The default duty cycle is set earlier (60% in my case) and I'm using the "*" and "#" keys of a 4x4 keypad to adjust it. The "*" (keypad code 11)and "#" (keypad code 10) increase or decrease the duty cycle 10% each time.
Greg
viscomjim Guru
Joined: 08/01/2014 Location: United StatesPosts: 925
Posted: 02:46am 19 Nov 2014
Copy link to clipboard
Print this post
This is all very cool. No more pot for me... what?