How do I get a peek into the LCD library?

Hi there,

Let me first admit that my last major experience with programming was back with good ol’ GW Basic. And also that I’m having a blast with the Arduino!

I need to take a peek at the code included in the LCD library that is called with the command:

#include <LiquidCrystal.h>

Where would I find it? How can I view / edit it? And finally is it in the same Arduino-13 programming language or is it based in C# or in Processing?

And just in case you’re curious I’m working with an LCD whose backlight doesn’t come on so I’m wanting to check the initilization commands written into the library.

Thanks for any & all help!

all the libraries are in directories under hardware/libraries – look in the directory where you installed arduino. There you will find a directory called LiquidCrystal with the source files. LiquidCrystal.cpp is the source file (it's a C++ file) and LiquidCrystal.h is the header file. You can view and edit these with a text editor, although some like notepad do not expand carriage returns so you may want to download one of the many free programmers editors.

But backlight is not controlled by the library so looking at the code will not help with that. The problem will be with the hardware – check the wiring and polarity of the power. Also check to see if your LCD needs a series resistor, some do and some already have built in

Good luck!

Depending on the size of the LCD, if it is fried, you can replace the LED. I goofed my + and - on my breadboard and blew it. I used a 3.5mm high brightness Blue LED to replace the one that was in there (The one I pulled was a white rectangle, but the 3.5 fit very well). Just make sure you have the polarity correct before you solder it in.

Hi

Backlight "doesn't come on" can be a lot of things. First thing, make sure you know what you have. Do you have the datasheet?

Next, you didn't specify what your backlighting was, I am going to assume it's LED - however if it's not please correct me. That's what MYX thinks, you reversed the polarity of the LED and popped it. It's usually Gnd on #16 and V+ on #15, and as stated it's not (normally) controlled via software.

However you can use any spare output pin on the Atmel as a backlight control pin, though. I wouldn't hook it up directly to the Arduino - use a transistor or mosfet as a current buffer - why heat up the microcontroller with this? Heat it up with code instead. And, if you use a PWM pin, then you can control the brightness of the backlight, not just on & off. (well, technically it IS on and off... just really fast.)

Good luck, and remember: the more information you provide, the more accurate the replies will be.

Thanks to all for the good information.

I didn't think to provide the LCD model it's a Crystalfontz CFAH2004D-YTI-ET. According to their datasheet it is indeed an LCD backlight utilizing pins 15&16. After reading MYX's response it does sound like I nuked it since I had some wiring issues before the LCD would display anything. It is kind of odd though, even now it will not display anything without pins 15 & 16 being wired up properly.

And just to close the loop; once I got that peek into the LCD library (and learned to convert HEX to BIN) I found that the "Display ON/OFF Control" command was indeed turning on the LCD. I wasn't sure if this applied to the text on the LCD or the backlight which is why I wanted to check.

I might try MYX's suggestion of replacing the backlight, but I think that's a whole other project unto itself.