LCD Backlight Proper Wiring
What would the proper way to wire the LCD backlight to a port and setting that port so that it comes on. Currently I wired the backlight to +5v on the plus side and the minus side of the LCD backlight to portd.0. The LCD backlight is an LED. So to turn the backlight on I set LOW PORTD.0 which I understand and to turn it off I set it HIGH. This method puts +5vdc on the LED at all times. Of course it does not come on until I set portd.0 low which is understandable. I'm just trying to figure if this is standard way to hook something like this up. Can a variable be set to HIGH to end this confusion?
I'm sure this is a dumb simple question but I'll ask anyway.
Example:
_OFF = High
_ON = LOW
portd.0=_on
Thanks
David
Much thanks...and a follow up question(s)
Melanie, Thanks for the great tips. I think I am just going to add a couple
2N2222's to my circuit to take care of the relays I am drving and the LCD backlight for now. I see on rentron.com he's using the 2N2222 with a 10k resistor as a relay driver so I would assume that driving the LED for the backlight the 2N will work just as well. The specs say it will drive up to
600ma so I should be good to go with those, see any problems with that? So let me ask a stupid question. As long as whatever device I am going to drive stays within the boundaries of being able to be driven by TTL signal I'm ok coming directly off a pin on the pic, perhaps I may need a pull up or pull down resisitor but I won't be overdrawing current that could damage the pic correct? Now for the really stupid question which really shows my lack of electronics knowledge the relays I am going to be driving are +12vdc. It's ok to mix that +12vdc through the 2N2222 to drive those right? If that is so stupid you don't want to answer I will understand.
Thanks
David
I like soldering (not!) Good advice thanks.
Melanie, I think you're going to have to start to charge tuition... I realize we've gone beyond a question regarding a general pic question I hope you don't mind the follow up. If I just asked you for the value of the base resistor I would not end up learning anything it would just show I am lazy and I am not.
Ok so let's say I just want to drive the backlight and go with a 2N2222 to accomplsih this. If I review the data sheet and the calculation I've looked up to calculate the needed base resistor I get: (Sorry if my symbols aren't exactly accurate. Hfe and Vbe from the datasheet)
Ib = Ic / Hfe = 120ma/100 = .120/100 = .0012
Rb = (Vdc - Vbe ) / Ib = (5 - .6 ) / .0012 = 4.4/.0012 = 3666 = 3.7k
If I add in a 30% extra 5 - .6 / .0012 * 1.3 = 4.4/.0015 = 2933 or approx 3k on the base resistor.
Did I get close?
Thanks again for your advice and assistance.
David