GLCD problem

Hi all

I'm trying to get this GLCD to run but no luck

the display lights up and but i cant see anything on it and when i run GLCDdiags i get this do not know if it is good or bad

Serial initialized

GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1 Panel Configuration:ks0108

Pin Configuration:ks0108-Arduino

GLCD:ks0108 DisplayWidth:128 DisplayHeight:64 Chips:2 ChipWidth:64 ChipHeight:64 CSEL1:14(PIN_C0) CSEL2:15(PIN_C1) RW:16(PIN_C2) DI:17(PIN_C3) EN:18(PIN_C4) D0:8(PIN_B0) D1:9(PIN_B1) D2:10(PIN_B2) D3:11(PIN_B3) D4:4(PIN_D4) D5:5(PIN_D5) D6:6(PIN_D6) D7:7(PIN_D7) Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450 ChipSelects: CHIP0:(14,0x1, 15,0x0) CHIP1:(14,0x0, 15,0x1) Data mode: d0-d3:nibble mode-Non-Atomic

d4-d7:nibble mode-Non-Atomic

Diag Loop: 1 Initializing GLCD Displaying ChipSelect Screens Walking 1s data test Wr/Rd Chip Select Test Testing GLCD memory pages Horizonal Page Test Chip: 0 Pixels 0-63 Vertical Page Test Chip: 0 Pixels 0-63 Horizonal Page Test Chip: 1 Pixels 64-127 Vertical Page Test Chip: 1 Pixels 64-127 Full Module Horizontal Page Test:Pixels 0-127 Full Module Vertical Page Test:Pixels 0-127 Tests PASSED GLCD.SetDot() speed (K ops/sec): 17.83

do you have a potentiometer hooked up between ground, vo, and the output going to the contrast pin?


and when you turn it all the way in one direction does the screen start to turn black?

no it does not but i can measure the wiper and i get 0 to 5v on that side so it seems to be working.


Well I measure my ks0108's wiper and I get -5V so yours seems to be about 10V away from an optimal value.

The third pin on the pot should be wired to the Vee pin which is around -9V, not +5V. I found that when I didn't do that I didn't see anything either.

yes, these screens pretty much need a negative voltage on their contrast pin to work. thats probably your problem. if you cant find the negative output, it may not even be there. some lcd manufacturers dont include the circuit on their boards.

... but i can measure the wiper and i get 0 to 5v on that side so it seems to be working.

You should be measuring between 0 and some negative voltage. Using the pin information on the data sheet in your link the ends of the potentiometer go to pins 1 and 18 and the wiper goes to pin 3. Hopefully the '(0V)' mentioned for pin 18 is in error, otherwise you are going to have to come up with a negative supply for that end of the potentiometer.


I now have a 0 to -5V on wiper still cant see anything or affect the contrast odd /Peter

What voltage do you have at pin 18?


The data sheet is here:

On page 2 of that it mentions the circuit for the contrast adjustment (OK, how do I insert images onto this site and show them?).

As I read it, you connect one end of the pot to +5V, the other end to -10V, and the middle (wiper) goes to V0 (pin 3).

Also the circuit mentions Vee (the negative voltage) in a number of places without giving a pinout for it. Maybe it is there somewhere else on the board?

The data sheet also says on page 4 that "Supply voltage for LCD (VDD - V0)" is typically 8.2V (doesn't say -8.2 but whatever). I presume if you wipe between +5 and -10 you would find -8 near the middle.

The data sheet also says on page 4 that “Supply voltage for LCD (VDD - V0)” is typically 8.2V (doesn’t say -8.2 but whatever).

This would make VO about -3.2V (5 - 8.2) with respect to GND. The potentiometer will work either way, between +5 and the -V source or between GND and the -V source. The latter connection will provide finer control. The former will provide a wider range, including positive voltages.

The data sheet also shows the VDD and VSS connections reversed from many other devices so there is a possibility that is the problem, although dozer should have noticed heat and/or smoke if the power supply is backwards.

If there is a negative supply available on the pc board it is typically available at pin 18. I would measure the voltage there (with respect to GND) to make sure.

You have to remember that these data sheets have undergone at least one translation and possibly several. Also they may have been edited by non-technical people and the drawings may have also been created by non-technical people.


Peter, I'm the author of the diag sketch included in the glcd library as well as co-author of the library. With the diags passing, that is a very good thing. This means that the data communications between the library code and the GLCD is working and the memory on the GLCD passes memory tests. The only things not tested is the contrast circuit and the backlight.

That said, there is a potential issue around RESET that can cause this type of issue (display not being enabled - so no pixels are visible - regardless of contrast setting).

I also noticed that you are not using an arduino pin to reset the glcd module. (doesn't show up in diagnostic output - thanks for including that)

-->>Do you have the reset pin on the glcd hooked up to a reset signal on your board? (not sure which arduino board you are using)

The reason that I ask is that down low in the initialization code if the reset pulse going into the ks0108 module is slow rising, then I have seen an internal hardware race condition (bug) on several ks0108 glcd modules in which the module will say reset is complete but the internal ks0108 chips are still held in reset.

---- Gory details....... The problem (on some glcds) is that the reset signal is fed directly to the glcd status register as well as holds the internal ks0108 processors in reset. If the reset pulse rises very slowly, the reset bit in the status register goes away before the processors are reset. To make things worse the busy bit is held clear when the processors are in reset state and is only set by the processors.

The first thing the low level glcd libarary code does is turn on the displays. (128x64 ks0108 modules actually have 2 displays internally that are side by side) If this slow rise reset condition occurs, the low level code commands to the glcd will be lost because the low level software saw the the glcd module was no longer in reset and was not busy, so it started talking to it. Because the glcd processors are still in reset, the busy bit does not show up when commands are sent to it, so it looks like they are working.

-----------------------end of details

To ensure that this is not the issue either hook up an arduino pin to reset the module (recommended if you can spare the pin), or make sure that the reset pin the glcd (pin 14 on your glcd) is hooked up to a reset signal in the Arduino sp that the glcd is reset with the arduino reset button is bashed.

(Just reviewed the code and noticed another potential issue - Not sure why I turned off the reset status check code by default) So... another thing that can be possible is that glcd board is slow initilizing. Currently with all the reset issues, the code has the RESET bit polling disabled and so it it may jump on the glcd module too quickly if it is slow initializing. This can occur if the GLCD.Init() is called first thing in a sketch on slow initializing glcd board. To turn on the reset status polling, add this line


to the glcd_Config.h file down near the bottom with the user defines.

Another thing I noticed that seems strange is that I have dealt with many different glcds with about 10+ different pinouts, and while things move around and many others are also a bit "strange" or just flat wrong, I've not run across any ks0108 modules that didn't include the negative voltage (vee) signal, which most modules have on pin 18. Since you said that you have now are seeing 0 to -5 on the wiper which should be hooked to pin 3 on your glcd, I'm assuming that the data sheet is wrong with respect to pin 18. That it really is Vee vs Vss.

-->>But can you confirm that you see 0 to -5 now showing up on pin 3 on your glcd? Verify this before you run down messing with the reset stuff.

-- bill

I’ve not run across any ks0108 modules that didn’t include the negative voltage (vee) signal, which most modules have on pin 18.

Bill, the spec sheet says pin 18 is “Signal ground for LCM (GND)”. If that is just a misprint (where else would Vee be?, also pin 2 is also assigned to that function) then grounding it might indeed cause malfunctions inside the unit.

Perhaps if Peter disconnects pin 18 from ground first, and then measures if it has something like -10V on it, then that might be a candidate for wiring to one side of the contrast pot.

Thanks for the post bperrybap

haven't had time to test more at the moment Still think I should get some kind of response from screen when I'm turning the trim pot but I'm probably wrong :)

Nick, I saw the data sheet. But then Peter also said he was now getting 0 to -5 on his pot wiper. I assumed (perhaps incorrectly) the the pot was hooked to pin 18 and that it was not grounded, which would mean that pin 18 was really Vee and not Vss.


I would not connect pin 18 to ground, if pin 18 is really Vee then connecting it to ground will potentially fry the on board negative voltage generator. First thing should be to disconnect pin 18 from everything and measure its voltage.

If the glcd DISPLAY_ON commands fail, the lcd display may not be on. Some modules power up on and some power up off, some turn on only 1 of the 2 displays, and some power up randomly enabled. The only way to make sure the full display is on is to send the DISPLAY_ON command to each display. If a display is not on, no matter what the contrast input is, you will see nothing. because the display is off.

First thing is to measure the voltage on pin 18 with nothing connected to it. if it is negative voltage then hook it up to the pot and make sure the negative voltage is present on pin 3.

If so, then it is likely there is a reset issue affecting the low level initialization in the library communication to the glcd module and the DISPLAY_ON command is not working properly.

--- bill

Bill, I tried to get him to measure the voltage on pin 18 back in reply #9. It just dawned on me that he has to have the +5V supply connected as well for this to work and now we get back to the issue of the correct connections that I mentioned in reply #11. What is your take on that part?


Don, Since diags passed, pretty much all the other connections have to be correct. In particular 5v and gnd on pins 1 & 2. The only things left out of diags is RESET, contrast control, and led backlight. The diags also can't verify if the chip select pins are hooked up correctly but that will be a simple visual thing once the display becomes visible.

So I think since the glcd passed diags, and the first post says "the display lights up", that it is down to contrast and reset control.

Peter, Can you tell us exactly what is hooked to glcd pins 3, 14, and 18. Don't hook ground to pin 18, but tell us the voltages you see on pins 3 and 18.

--- bill

Since diags passed...

Oops - I overlooked that part.

I still think it's the potentiometer connections. As Nick mentioned in reply #10 the data sheet mentions Vee (in one of the diagrams) but there is no Vee shown on any of the pc board pins. Since pin 18 is labeled Vee on the datasheet for other boards this may very well be a typo or editorial error on this datasheet.


Hey there... wanted to offer you some advice that got me through my frustrations with this panel.

I have the ks0108 LCD as well, and the trick to getting it to work is to make sure you are using the correct wiring diagram for your version of the panel... in my case, i had the B model so had to use the B wiring.

The pdf datasheet tells you how to tell which version of the panel you have.

The other issue I had was my screen width was offset... by that i mean, instead of going 0px - 128px, my display was working like this 64px-128px0px-63px. So 0 was in the middle of my screen and if i wrote text it was wrapping to the other side.

The fix was an update to the glcd by removing the #define glcd_ xy 2 chip macro and modifing it to handle the offset. It was a pain in the butt, and is a dirty hack, but it does work perfectly.

Since I am more a fan of having it work well, then getting it to work well, correctly, at the cost of alot of time, I'm happy with my solution.

I also built a simple harness for the glcd screen that I'm using that works wonders, (Basically a simple 'shield' that instead of riding on the arduino, uses a ribbon cable so that I can mount it anywhere I want in my enclosure.)

Best of luck to you