Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switching LCD Backlight on and off

Status
Not open for further replies.

gregmcc

Member
I'm busy fiddeling around with a microcontroller, keypad and lcd and have question about the lcd backlight.

everytime I press a key on the keypad I would like the lcd backlight to come on for say 2 seconds. if another key is pressed the light stays on. if no key is pressed within 2 secs the light goes off.

the problem is that i've run out of pins on the microcontroller so am looking for another way to do it - otherwise I could have used some coding to do it. When a keypad is pressed a buzzer makes a short beep.

Now my question - can I link the buzzer to some kind of timer (555?) to do the switching of the light on and off.

Can anyone offer any help - am I on the right track, or is there an easier way?
 
You can use a 555 timer wired as a one-shot (monostable multivibrator). Set your pulse width to 2 seconds and fan the output pin from your controller to both the buzzer and the one-shot.

Every time your buzzer goes off, you will get a single pulse 2 seconds long.
 
gregmcc said:
If I press the keypad within the 2 seconds, will the output be extended by a further 2 secs.

no, not with a basic monostable setup

can we see what the rest of your io lines are doing? maybe there's a way to optimise one of them, to free up a dedicated line for the backlight ... then you have the ability to control the backlight, without sounding the beeper, like turning the backlight on when it's dark out and stuff
 
gregmcc said:
If I press the keypad within the 2 seconds, will the output be extended by a further 2 secs.

Oops, I overlooked the fact that you needed a retriggerable one-shot.

It just so happens that you can get dedicated retriggerable monostable multibrator (retriggerable one-shot) chips and they cost less than $1. If you go do Digikey, search for "monostable", click the multivibrators link, and under the features column select one of the "retriggerable" descriptions and then narrow your search. A number of possibilities will pop up.
 
But basically putting in a 555 when you've got a uController is just heresy. Suggest getting a controller with more pins or try to find a way to save a pin elsewhere.
 
thanks for all the replies. I found a chip on digikey which might do the trick. Will try it out tonight and let you know.

At a later stage I might have to look at using another microcontroller more pins - a light that comes on after its dark is a good idea! :)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top