Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help in programming PIC for turning off LCD backlight in idle mode.

Status
Not open for further replies.

richardlaishram

Member level 4
Member level 4
Joined
Jan 6, 2013
Messages
77
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Location
Planet Earth
Visit site
Activity points
1,804
I'm trying to work on a small project having an LCD interface. I'm using PIC16F877A µC for interfacing the LCD. I want to turn off the LCD Backlight after a few seconds when no key is pressed (I'm using interrupt to poll for key stroke). Again I want to turn on the LCD when there is a keystroke. Please help me if there is a solution to this. I'm somewhat familiar with PIC programming, so you won't find me that much difficult to teach me. Thanks in advance.
 

You can use some small MOSFET like si2301-sot23 or something like this to control the backlight. Arrange in your program some counter that will be erased every time when key is pressed. In case the counter reaches some value (value equals to desired delay) the backlight turns off.
Another way to do it is by hardware delay.
 

Thanks, I'll try writing a counter to control the backlight pin, but I'll ask again if I have any difficulties. Thanks in advance.

- - - Updated - - -

Arrange in your program some counter that will be erased every time when key is pressed. In case the counter reaches some value (value equals to desired delay) the backlight turns off.
Here the problem is that there's a Mode selection button which keeps changing the mode everytime the Mode button is pressed, so how to I keep the count?
Another way to do it is by hardware delay.
Please enlighten me on this, I'm not much familiar.
 

okay, thanks.

Hi,

Bit pointless using a micro if you have to create a delay with a 555 chip.

Pic chips have several inbuilt 8 and 16 bit timers 0 1 2 etc to be used for just such events.
Use the ISR on the timers, which are short durations, to increment a simple second level counter, if needed.
Timer 0 can give up to a 2 second delay on its own with a 4 mhz oscillator.

If nothing else is functioning , apart from checking for a new key press then you can simply use a software delay.
 

You can use timer in compare mode see in the attached link.
1) Make interrupt by compare module with exact interval (10 - 100msec)
2) Set some global flag and turn on the backlight every time you sense some key is pressed except Mode key.
3) In the interrupt routine check the flag

if(flag)
{

counter = Delay; //Delay means some value which correspond to desired time delay
backlight = on;
} else if(counter>0)
counter --;
else
backlight=0;
flag=false;

ww1.microchip.com/downloads/en/devicedoc/31014a.pdf
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top