PDA

View Full Version : LCD Backlight Time-out



Falcon
08-10-2008, 09:31 PM
Hello,I'm new to the forum and am working on my first BS2 project using an LCD.

The project is a thermostat with several pushbuttons to set the desired temperature. I bought the 2x16 serial LCD from Parallax and have it working. My problem is the backlighting. The project will be powered by a 9v battery so I need the backlight to remain off unless a pushbutton is pushed, then come on for only a preset time after a pushbutton is pressed. I've determined that a pause will not let any other program activity occur so that won't work.

How else can I accomplish the backlight time-out?

Thanks,

Falcon


Mike Green
08-10-2008, 11:23 PM
There are command characters (see page 8 of the documentation) you can send to the display to turn the backlight on and off. Whenever you update the display, you would send a "backlight on" character to the display. While your program is waiting for a button to be pushed your program would use a short PAUSE (like 1/10 of a second ... fast enough so a user wouldn't notice, yet substantial), you will decrement a "timeout" counter. When that counter goes to zero, your program will send a "backlight off" character to the display. Whenever the user pushes a button, the counter would be reset to the time-out interval. This time-out won't be exact since there's no direct clock for the Stamp, but it's close enough for this purpose.

SRLM
08-11-2008, 02:46 AM
You'll probably want to use a pause statement of a small value, like 1 or 2. Otherwise, if you use 100 (1/10 second) then the user may push the button very fast and the press isn't registered.

Falcon
08-11-2008, 07:38 AM
Well, that worked like a charm. Don't know why I didn't think of it myself.

I appreciate the replies.

Falcon