Easy LCD BackLight


Closed Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2003
    Posts
    2,358

    Default Easy LCD BackLight

    I thought I'd post as few LCD Notes, especially since there's a lot of interest in the 'Cool Blue' LCD's that have been discussed on the Olympic Timer Thread.

    Previously in this forum section I have posted a way of performing "Easy LCD Contrast" using just two Resistors and a spare PWM pin from a PIC to give you software control over your Contrast. Figure 3, in the attached .jpg shows the arrangement for the Cool Blue along with the Resistor values that work real well.

    Code:
    	'
    	'	Subroutine Sets LCD Contrast Level
    	'	----------------------------------
    SetLCDContrast:
    	DataA=DataA*40
    	HPWM 2,DataA,1000
    	Return
    DataA is a Byte variable. Entry into the subroutine with DataA holding a value between 1 and 5 gives five steps of Contrast which is more than adequate. You can easily rehash the subroutine to your desired range.

    Figures 1 and 2 give a couple of arrangements for "Easy Backlight", allowing you software control for the LCD's Backlight. Figure 1 shows the arrangement using a spare driver from a ULN2003, 2004, 2803 etc etc. Figure 2 shows the same arrangement using a low/medium power Transistor. Now I use BC639's because we buy them by the million and they only cost about a cent each when you do that. You don't have to use a transistor anywhere near that heavy.

    The value of R1/R2 will depend on your supply voltage to the Backlight LCD. Select a value that gives no more than around 20mA when PWM=100%. You may want to run at a higher current at your own risk (I have run these at 40mA!!). Don't send me any LCD's under warranty on which you've blown-up the Backlights. Actually, if you're unfortunate enough to have done that (never yet seen it happen I should say), the single White LED is easily replaceable!

    Code:
    	'
    	'	Subroutine Sets LCD BackLight Level
    	'	-----------------------------------
    SetLCDBackLightOFF:
    	DataA=0
    SetLCDBackLight:
    	DataA=DataA*51	
    	HPWM 1,DataA,1000
    	Return
    Similarly this routine sets fives steps for BackLight adjustment with DataA entering the subroutine at SetLCDBackLight in the range of 1-5. SetLCDBackLightOFF is self-explanatory.

    If you've got a PIC with a couple of PWM pins, then you've got instant Software Control of both Contrast and Backlight. Usually, if I'm fitting an LCD, then the PIC is almost always something like a 28-pin device. My favourite is the 16F876 because you can devote all of PortC to the LCD for example... (4 Data Pins, E, RS, and both HPWM's all nicely fall out of PortC).

    If you're running the BackLight at 5v (there are good reasons why I don’t do that), you can just plug the Backlight pin straight into the PIC without the intermediate Transistor or Driver. Why don't I run my BackLight from 5v? Quite simply, I tend to run my PIC circuits at only a very few mA, this allows me to put in cheap and cheerful Regulators. Any significant current draw on cheap Regulators varies the +5v by a few millivolts... now if I'm using the ADC's (as I invariably do), and I have my +VRef strapped to the +5v line, the small fluctuations on the +5v line correspondingly throw the ADC readings fractionally.

    Melanie
    Attached Images Attached Images  

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. LCD Backlight Proper Wiring
    By DavyJones in forum General
    Replies: 11
    Last Post: - 26th July 2009, 23:01
  4. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  5. 16x2 lcd with blue backlight selling
    By macx75 in forum Adverts
    Replies: 5
    Last Post: - 8th May 2006, 07:12

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts