SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By cheesy
#14513
I got one of these nice black LCD displays from sparkfun, and on the product page it says it's based on the HD44780 controller, but the datasheet for the display says it uses the KS006U, or equivalent...are they equivalent?

http://www.sparkfun.com/commerce/produc ... cts_id=709

Now, I thought I had everything hooked up correctly but the microntroller doesn't seem to run when it's all connected. The datasheet, the stuff printed on the PCB, and what actually seems to work don't seem to match up.

The backlight works if I connect it according to the +/- markings on pins 15/16, which appear to be opposite the datasheet

Datasheet:
Pin 15 - K - Power supply for BKL (0V)
Pin 16 - A - +4.2V for BKL

(what do K and A stand for?)

PCB Markings (what works):
Pin 15 +
Pin 16 -

At the other end...

Datasheet:
Pin 1 - Vss - GND
Pin 2 - Vdd - +5V
Pin 3 - V0 - Contrast adjustment

Now, when everything is connected except pin 2 and I measure the voltage on pin 2 I get 0V! Thus when I connect pin 2 to Vdd it shorts and causes the microcontroller to turn off. What's going on?

Also, can someone explain the contrast adjustment? How does this get hooked up? I assume through a potentiometer somehow?

Some other things on the datasheet are confusing...

"BKL to be driven by pin1,pin2, or pin15,pin16, or A,K"

What does that mean?

And "N.V. optional"...what's N.V.?
By Kuroi Kenjin
#14519
A is anode and K is cathode (in the german spelling - Kathode?). That's odd that it seems backwards on the datasheet.

The contrast adjustment is to a wiper of the potentiometer with either end to power and ground.

I've seen the optional A,K or pin 15,16 backlight power, but the pin 1,2 is new to me.

N.V. I believe is negative voltage. If you have a 3.3V system, then you'd apply -0.9V to where backlight ground is for the 4.2V.

I'd check for shorts on pin 1 and 2, something sounds like it's been goofed somewhere (on the LCD module or a loose/misconnected wire on your breadboard).
By cheesy
#14534
Thanks. I checked for a short between pins 1 and 2 yesterday and there wasn't one, but I'll check again when I get home.
By cheesy
#14566
There's no shorts between any of the pins. Still no luck, when I simply connect the LCD the microcontroller stops working even if I'm not using those pins.

I can't think of anything else that would be wrong.

I'm wiring the LCD backlight to the 5v supply, even though it should be 4.2v, but I don't see why that would be a problem.

Any other ideas?

Could it be a problem with the microcontroller? It exhibits the same behavior (turning off, stops working until reprogrammed) if I touch the pins with my finger while it's running (probably not a good idea anyway :wink: )
By Kuroi Kenjin
#14569
Nah, probably not a good idea to touch things when they're on. What is you setup/circuit? What are you powering off of?
By cheesy
#14613
I've tried powering it from both the PICKit2 and a power supply (simple RadioShack power brick) through a 7805 regulator (although I realized I didn't use the recommended capacitors.)

I'm programming using the PICKit 2 and leave it connected while testing, but that's the point of ICSP...

Chip is the PIC18F2455.


Pin 1: ICSP Vpp and the recommened (from PICKit 2 manual) isolation circuit + resistor to Vdd (470 Ohm to 10 KOhm to Vdd and 0.47uF to Vss.

Pin 8 and 19: Vss
Pin 20: Vdd (0.47uF cap across pins 19 and 20)

Pin 17 (RC2): test LED anode (cathode to Vss)

Pins 19, 29, 30 (RD0, RD6, RD7): RS, R/W, and E from the LCD
Pins 33-40 (RB0-RB7): Data lines 0-7 of the LCD

Vdd and Vss for the LCD and backlight go to Vdd and Vss on the breadboard.

Contract adjustment goes to wiper of 10KOhm pot connected to Vss and Vdd.


That's about it. Sorry for lack of a circuit diagram, I'll try to do one later. Thanks for any help.
By Philba
#14617
ok, simple diagnostics time. start with power.

check the regulator, unloaded.
what is the voltage going into your 7805? should be at least 7 or 8V
what is the voltage coming out of the 7805?
then check it loaded.

assuming good, check your microcontroller. does it work with out the LCD hooked up? (how do you know? I'd blink an led or use a scope to look at a pin you toggle), If yes, then hook up just pins 1 and 2 of the LCD (no backlight). if that woks, must be the backlight.

The backlight is spec'd for 150 mA. That isn't it's draw - you hve to limit that. without a current limiting resistor, who knows what the current would be (with 1 ohm of resistance, it would have been around 800 mA, gulp). It might have pulled down the Vdd and caused the uC to not run. hopefully, you didn't blow the leds (though they would have been VERY bright for a short period. heh heh. so I bet you are ok. I'd try a 5 ohm resistor in series with the backlight.
By cheesy
#17997
Alright, I've started from scratch following all tips from this topic, still no luck.

I added a current limiting resistor on the backlight LED, which seems to help. The PIC now runs fine even with the LCD connected, except when the R/W pin is connected to a PIC pin (but it works fine if I ground it, which should be ok anyway)

I'm also powering the PIC from my PICkit 2 programmer, which is regulated I believe, and should be able to supply enough current (?)

Now, when I try some of the example code (with all settings correct... 8 bit port, correct pins, two lines, 5x8 font, blocking, delay mode, etc) Nothing seems to work, I just get the top line completely blank, and the bottom line completely filled solid.

When I send it a "clear" command I can see it flicker slightly, but nothing changes.

Any suggestions?
By AC
#18019
Did you initialize the display? You first need to initialize it for 4 or 8 bit mode (depending on how you have it wired.)

Most compilers have built in LCD routines that should handle the initialization.

You also need to wait ~250-500ms for the display controller to start up before sending any commands to it.

Not familiar with that PIC. Make sure none of the ports you are using are set to analog.
By reklipz
#18033
yep, portB<0:4> are default to analog in most programmers config bits, best to make sure you set this bit to digital IO or add the line of code to do it no matter what.
By cheesy
#18039
Yes I'm using the MPLAB C18 xlcd.h routines to init and everything.

I think there's about a 1.5 second delay before I start the init too, but I'll have to check that.

And yes I set port B to digital.



The only thing I can think of is I somehow fried the controller.
By tom2006
#18054
Hi
This may sound basic, but have you adjusted the constast POT, Sometime if its not set correctly you may not the char's being displayed because there so light.
By cheesy
#18055
Yes. Also, only half of the screen is solid, the other half is blank.
By AC
#18071
Isn't the 18F2455 a 28 pin part? Your LCD hookup description uses PortB pins 33-40, but you list the correct Vss/Vdd pins for the 28 pin part.

Maybe you are compiling for the wrong type of PIC. I would double check your pin assignments and wiring.
By cheesy
#18086
I forgot to mention I switched to the 4455, which is essentially the 40 pin version. The pins and everything are correct.