GLCD library version 3 (end of life - no longer supported)

Thank you for your prompt reply.

I have made the LCD display lit up. It is blue now. I have installed the glcd in the sketchbook location.

I got message "Done compiling" and "Binary sketch size: 6108 bytes (of a 258048 byte maximum) after upload the sketch,
I used the "HelloWorld" and "GLCDdiags" files Under File of IDE, Sketchbook>libraries>glcd> both of them got the above messages and the green light on the board blinks with "HelloWorld" and stay green with "GLCDdiags". Please advise how can I made "Hello World" or anything dispaly on my LCD display.

thanks again.
cc

Diags reports information out the serial port.

Unless the glcd is bad, incorrect wiring is always the cause for the glcd not working properly.

Since the backlight is now working, you have changed something with the wiring.

Make sure that you have the correct data sheet and wiring up the glcd according to the datasheet
and the documentation included with the library.
Wiring is not something you want to be guessing
as incorrect wiring can damage the glcd or the Arduino board.

When things are not yet working. Use the diags sketch.
Until diags pass, there is no reason to try to run any other sketch.
Diags will display useful information on the serial port
about how the library is configured and any potential testing failures.

--- bill

Hi, Bill:

Thanks again.

Here is the datasheet I used to do the wiring
http://fritzing.org/projects/128x64-lcd/
I also read the the ks0108mega.h file
#define glcdDI 36 // D/I Bit
// Reset Bit - uncomment the next line if reset is connected to an output pin
#define glcdRES 30 // Reset Bit

it seems the only difference for the datasheet I used and those states at the config file is those I copied above, is there a difference of D/I bit and RS. My reset is 17 not 30, should I use 30 instead.

When I compile the sketch, do I need to disconnect the reset, let the sketch upload and connect the reset.

I have used the GLCDdiags and nothing happen to the LCD display. you mentioned about using the diag and until it pass, is this diag the same as the GLCDdiags sketch I used. When I compiled the GLCDdiags, other than the comment regarding the byte, there is no other information. You also said diag reports information out the serial port, where can I find the serial port, bear with me, I know it sounds kind of stupid.

thanks
cc

carrieklchow:
Hi, Bill:

Thanks again.

Here is the datasheet I used to do the wiring
128x64 LCD

That is not a data sheet. That is a wiring diagram.
A data sheet will show all the technical information about the lcd panel
and will have the pinout for the lcd panel.
There are many different pinouts for ks0108 glcds and if things are improperly hooked up
it can damage the glcd or the Arduino board.
That is why it is very important to locate a proper datasheet for a glcd to see
the functions for each of the 20 pins to ensure that the pin connections to the Arduino are correct.
Here is what a couple of ks0108 datasheets look like:
http://www.longtech-display.com/produts/LCD%20MODULES/longtech%20pdf/LGM12864B.pdf
http://docs.bgmicro.com/pdf/lcd1030.pdf

Pretty much all glcds have their model silk screened on the back of the board.
Look at the back of the board and you should see the lcd model.
It will usually have "12864" somewhere in the model name.
You can do a google search with the model name to locate a datasheet for the glcd.

I also read the the ks0108mega.h file
#define glcdDI 36 // D/I Bit
// Reset Bit - uncomment the next line if reset is connected to an output pin
#define glcdRES 30 // Reset Bit

it seems the only difference for the datasheet I used and those states at the config file is those I copied above, is there a difference of D/I bit and RS. My reset is 17 not 30, should I use 30 instead.

Sorry about any confusion here.
RS and DI are the same. Some data sheets call the pin RS and some call it DI.
They are the same thing.

The numbers like 36 for glcdDI and 30 for glcdRES are Arduino pin#s.
All the numbers you see in the glcd pin config files like ks0108_Mega.h are arduino pin #s.
Numbers like "17" for reset are the glcd pin number.

If you want the glcd library to control the reset signal on the glcd, you hook
the arduino pin number for glcdRES to the reset signal pin number on the glcd.
In your case that would be hooking up Arduino pin# 30 to glcd pin #17.
Make sense?

When I compile the sketch, do I need to disconnect the reset, let the sketch upload and connect the reset.

Unfortuantely there are some issues with AutoReset on certain Arduino boards
which can cause uploads to fail when the the Arduino reset line is hooked directly to the glcd
reset pin.
The real issue is that some glcd modules need a reset pulse and some don't.
On the glcds that don't need a reset some glcds can work with the glcd reset pin tied to vcc
as shown in your wiring diagram. Some glcds will work when the glcd reset signal is left unconnected.

For the glcds that need a reset pulse the problem is that
some Arduino boards will not auto reset if the glcd reset pin is hooked up to the Arduino board reset pin.
For those glcds you must control the glcd with an arduino pin.

The safest thing to do at this point would be to eliminate any potential reset issue by letting
the library control the reset pin.
To do that you uncomment the line like you did and then hook Arduino pin 30 to the glcd reset signal pin.

After the glcd is working, if you don't want to use an arduino pin to reset the glcd, you can
try connecting the glcd reset pin to VCC instead. But if you do that make sure to go into the
ks0108_Mega.h header file and comment out the glcdRES line to make sure the glcd library
does not try to use the pin.

I have used the GLCDdiags and nothing happen to the LCD display. you mentioned about using the diag and until it pass, is this diag the same as the GLCDdiags sketch I used.

Yes sorry about my wording.

When I compiled the GLCDdiags, other than the comment regarding the byte,

"byte"? Not sure what you mean by this.

there is no other information. You also said diag reports information out the serial port, where can I find the serial port, bear with me, I know it sounds kind of stupid.

In the IDE if you click on the serial monitor icon, it will bring up the serial monitor.
Set the baud rate to 9600 and you will see the diagnostic messages from the GLCDdiags sketch.

If you post the information from diags, it will help to diagnose what is happening.

--- bill

Hi, Bill:

thanks a lot.

I have checked the wiring with datasheet, the board is SG12864J4. I have followed the pinoutB from this link :Arduino Playground - GLCDks0108

I have complied the GLCDdiags again, and here is the information from the Serial Monitor, I can only read that is a problem with the initialization of the GLSD and issue of reset. I don't know how to fix it.

Following is an extract the information from the serial monitor, it doesn't allow me to cut and paste and I just typed it out.

Reported Arduino Revision: 1.0

GLCD Lib Confirguration: glcd ver: 3 dlrd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec 5 10:50:07 CST 2011
GLCD Lib build number: 442
panel Configuration:ks0108
pin Configuration:ks0108-Mega

GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
CSEL1:33 (PIN_C4) CSEL2:34 (PIN_C3)
RW:35 (PIN_C2) DI:36 (PIN_C1) EN:37(PIN_C0)
DO:22 (PIN_A0) D1:23 (PIN_A1) D2:24 (PIN_A2) D3:25 (PIN_A3)
D4:26 (PIN_A4) D5:27 (PIN_A5) D6:28 (PIN_A6) D7:29 (PIN_A7)
Delays: tDDR:320 tAS:140 tDSW200 twH:450 twL:450
ChipSelects: CHIP0: (33, 0x1, 34, 0x0) CHIP1: (33, 0x4, 34, 0x1)
Date mode: byte

Diag Loop: 9
Initializing GLCD
GLCD initialization failed: RESET wait Timeout (status code: 2)

Can you teach me how to cut and paste from the serial monitor. BTW, I tried to open the Mega.h file but I cannot open it from my file directory, i.e. users/xxxxx/Document, how can I modify the .h file. I know probably in the future I need to uncomment the reset or change the file.

thanks again
have a nice weekend.
cc

You can copy and paste from the terminal window.
Just highlight the text in the terminal window,
then move to the window where you want to paste it and click the middle mouse button
to paste the highlighted text.

See this thread for some information about that error:

(ignore his information and just scroll down to my explanation of the error)

That error is always due to a wiring error.
Look at the diag output and wire up the glcd panel according the pins you see in the output.

You can see that glcd RW should be hooked up to arduino 35
glcd DI to Arduino 36
glcd CS1 to Arduino 33
glcd D4 to Arduino 26
etc...
Make sure that the wiring to the glcd is using the reported arduino pins for each glcd function.

Make sure you pot is wired correctly:

----- GND
------------------------------------- Vo (glcd pin 3)
----- Vee (glcd pin 18)

I don't know what you mean by this:

BTW, I tried to open the Mega.h file but I cannot open it from my file directory, i.e. users/xxxxx/Document, how can I modify the .h file. I know probably in the future I need to uncomment the reset or change the file.

I assume you mean {sketchbook directory}/libraries/glcd/config/ks0108_Mega.h ?
You showed some text from that file in your previous posts. Can't you open the file for editing using your favorite
text editor

--- bill

Good Day, Bill:

Thank you so much. The GLCDdiags finally works :slight_smile:

cc

What was the issue?
So, if possible, I can update the documentation to be clearer.

--- bill

is there a chance to use a shift register with the glcd library?
i ran out of free digi io´s, so i want to use a shift register (shiftout).

thanks
moe

Not right now.

While a simple shift register can be made to work, there are couple of technical hurdles.
The first is that it requires a frame buffer, the code already supports this but it does
consume quite a bit of: RAM 1024 bytes for a 128x64 display. This would preclude its use
on a m168 - (maybe thats not that big of an issue) but it may also not be acceptable
in some other environments.

The second is a performance issue.
The Arduino shiftout() routine implementation is not very fast.
There are better ways to write the code to make it much faster and
there are also other ways to clock out serial data than the way the Arduino guys implemented
their shiftout() routine that are even faster.

I've thought about designing a backpack board and offering it for sale.
The biggest challenge is that there are so many different glcd pinouts
that you can't make just one board.
I could make it where it has 2 sets of 20 pin holes on it and you pick
the correct set, but that is error prone and if the incorrect set is picked
it can blow up the glcd.
I'd really rather provide it as full solution (display & backpack combination)
to ensure it all works with the display

In the mean time, there is another library that works
with a SPI or I2C interface:
http://arduino.cc/forum/index.php/topic,52271.0.html

There is also this project which is pretty interesting but I'm not sure if works
with the latest glcd library.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1284207458

--- bill

hi bill,

thanks for your reply.

to use the i2c bus is very interesting. i´m a arduino beginner, so it seems a little bit difficult at first sight.
also to purchase the MCP23017 is not that easy in germany.
i ll try to get one.

my glcd type is a CFAG12846B-TMI-V

i hope the code will work with that kind of glcd type too
what do u think?

---moe

Nick's library was done on a ks0108 which is the same type of module that you pointed to.
The pinouts for his module may be different from yours, but it is the same controller on the
glcd module.

Keep in mind that Nick's library is different from this one and is a simpler design
so it doesn't have as much functionality as the glcd v3 library.

--- bill

Hello,

I am having a little bit of trouble with my GLCD, any help would be greatly appreciated.
I am using the GLCD Library and running the Diag tool and I am getting the same output as the guys before:

Reported Arduino Revision: 1.0

GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec 5 01:50:07 CST 2011
GLCD Lib build number: 442
Panel Configuration:ks0108
Pin Configuration:ks0108-Mega

GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
CSEL1:33(PIN_C4) CSEL2:34(PIN_C3)
RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0)
D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3)
D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7)
Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450
ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1)
Data mode: byte

Diag Loop: 1
Initializing GLCD
GLCD initialization Failed: RESET wait Timeout (status code: 2)

I have checked the wiring again and again and I'm sure it is correct. I am using the Pinout A from the Arduino Playground - GLCDks0108 tutorial. Last night I got the GLCD to show the example from the old library. Today I rewired the wires to make them more accessible and now nothing. (quick note: when the screen was displaying last night, the image seemed to be moved to the right, such that position 0,0 was in the middle of the screen and the image would go all the way to the right and then finish the image starting from the left to the middle, strange)

I am using the the HQM1286404.

Any suggestions on what the problem might be? I just hope its not burnt out. and if so how do I check for that?

It sounds like the glcd was working before, which is very good.
The included documentation has some tips for resolving a swapped screen.
(bring up the html documentation and go to the troubleshooting section)
A swapped screen is due to the chip select lines being swapped.

A non working display is wiring %99+ of the time.

The display now not working means something is now wired differently than before.
The RESET failed message is due to the library waiting for the glcd to be complete with reset
and it thinks the display isn't ready after waiting longer than should be necessary.
This almost always do to improper wiring.

Any ideas what might have changed?

Do you have a link to a datasheet for the glcd so that the wiring can be verified?
(I couldn't locate one for a HQM1286404)

If you look closely at the diags output, it indicates where each pin should be wired.
Have you verified that each pin reported by diags is wired to the glcd function indicated?
EX:
RW on the glcd should be connected to Arduino pin 35
glcd D0 to Arduino pin 22
glcd EN to Arduino pin 37
etc...

Can you post a few clear closeup pictures of your wiring?

--- bill

Hey Bill,
Sorry I took a while to respond, I tried yesterday with a different screen a ediptft43-atp via I2C, I have a quick question about sending commands, but I will post that in a another thread.
Needless to say I had to disconnect the HQM1286404, so to make sure that all wires all connected correctly this time I labeled them with some post-its. I then aligned them on the the breadboard and started connecting everything back.
Here is a link where I found more or less what the pin config is, cross referencing it to the tutorial it made some sense:
http://www.scienceprog.com/wp-content/uploads/2007i/Glcd/GLCD_pins.png

But now when I run the diag I get this:

Serial initialized

Reported Arduino Revision: 1.0

GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec 5 01:50:07 CST 2011
GLCD Lib build number: 442
Panel Configuration:ks0108
Pin Configuration:ks0108-Mega

GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
CSEL1:33(PIN_C4) CSEL2:34(PIN_C3)
RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0)
D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3)
D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7)
Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450
ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1)
Data mode: byte

Diag Loop: 1
Initializing GLCD
Displaying ChipSelect Screens
Walking 1s data test
Compare error: 0 != 1
Compare error: 0 != 2
Compare error: 0 != 4
Compare error: 0 != 8
Compare error: 7E != 10
Compare error: 11 != 20
Compare error: 11 != 40
Compare error: 0 != 80
TEST FAILED

Here are some pics of the set up now:


Thanks for the help.

-Martin

The first/original wiring sounded like it was working with the only issue being the chip select
pins swapped.
Can you get back to that wiring?

The diags is reporting an error that still looks like some sort of wiring issue.

You've got a lot of wires there.
Why so many?

It looks like you have small blue wires connecting to the wires
going into to the breadboard.
How are those attached to each other?

Twisting them together is very likely to create intermittent connections that
won't work reliably.
(Recently I saw another person chase errors related to this for a week or more.)

How about the wires going to the glcd?
Do you have any photos of the wires going to the glcd?

A wide shot that shows everything might help.
It can be helpful especially if it can show all the wires including the potentiometer.

--- bill

Hey,
I got it to work apperantly I was missing the reset pin #14. I connected to the the reset pin on the arduino board.
The only thing that I found is that it seems to have chip 1 first then chip 0, I flipped the CSEL1 with CSEL2 and bam now it is straight away.

Thanks a lot for all your help. It was a wire issue after all,
Here are pins what I have them connected to:
Pin / ARDUINO PIN
1.ground
2. power
3. to pot
4. D0 / 22
5. D1 / 23
6. D2 / 24
7. D3 / 25
8. D4 / 26
9. D5 / 27
10. D6 /28
11. D7 / 29
12. CSEL2 / 34
13. CSEL1 / 33
14. RESET / RESET PIN
15. RW / 35
16. DI / 36
17. EN / 37
18. POT
19. POWER
20. RESISTOR/GROUND

Thanks,
-Martin

I was fortunate to get one of the Arduino USB ADK boards at Google IO 2011.. haven't had much time to use it, but started hacking with it over the past few months... This weekend it got a sparkfun LCD-00710 128x64 graphic LCD...

Downside: soldering a header for wiring was annoying, but with the right iron its doable.

Upside: The GLCD v3 library worked first time.

Here's a picture of it in action...

Very Cool!
Have fun and feel free to post any feedback you have about the library and documentation.
--- bill

Hi Guys,
I am building a project in which I receive an image ID over Xbee and I use that ID to display the appropriate image on the LCD screen. These images are being read from an SD card. Since my project involves both Xbee and SD Card, I decided to use the Wireless SD shield (http://arduino.cc/en/Main/ArduinoWirelessShield). I am seeing some strange behavior occuring with regards to the LCD.
For accessing the SD card I am using the SdFat library. Since the Wireless SD shield connects the Xbee directly to pins 0,1 (RX,TX) of the Arduino Uno, I am just using Serial.print and Serial.read to send and receive data. For displaying images on the lcd I am using the latest version of the gLCD library.

The problem I am facing is as follows:
First when I receive and ID through Xbee, I use that to display image on the LCD and everything works fine. However after an iteration of the loop(), when I receive another image ID, I call the DisplayLetter function but it doesnt seem to do anything on the LCD. It is very strange and I have not been able to figure out what is going on. Any help is greatly appreciated. The LCD I am using is Nokia-11062 from Sparkfun.com (Color LCD - Breakout Board - LCD-11062 - SparkFun Electronics)

my DisplayLetter function:
void DisplayLetter(char fileName) {
int BR, BG, BB, FR, FG, FB, tempInt;
SdFile myFile;
if (!myFile.open(fileName, O_READ)) {
sd.errorHalt("Opening file for read failed");
}
graphic.SetBackColour(BR,BG,BB);
graphic.SetForeColour(FR,FG,FB);
for (y = 132; y >= 0; y--){
for (x = 132; x >= 0; x--){
unsigned char val;
char ch2 = (char)myFile.read();
char ch1 = (char)myFile.read();
int dig1, dig2;
if(isdigit(ch1)) dig1 = ch1 - '0';
else if(ch1>='A' && ch1<='F') dig1 = ch1 - 'A' + 10;
else if(ch1>='a' && ch1<='f') dig1 = ch1 - 'a' + 10;
if(isdigit(ch2)) dig2 = ch2 - '0';
else if(ch2>='A' && ch2<='F') dig2 = ch2 - 'A' + 10;
else if(ch2>='a' && ch2<='f') dig2 = ch2 - 'a' + 10;
val = dig1
16 + dig2;
if( val != 0xFF){
graphic.Plot(x, y ,3);
}else{
graphic.Plot(x, y ,0);
}
}
}
myFile.close();
}