Go Down

Topic: GLCD library version 3 (Read 82 times) previous topic - next topic

carrieklchow

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

bperrybap

#186
Feb 25, 2012, 06:45 am Last Edit: Feb 25, 2012, 06:48 am by bperrybap Reason: 1

Hi, Bill:

Thanks again.

Here is the datasheet I used to do the wiring
         http://fritzing.org/projects/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.

Quote

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?

Quote

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.


Quote

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.

Quote

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

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

Quote

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

carrieklchow

Hi, Bill:

thanks a lot. 

I have checked the wiring with datasheet, the board is SG12864J4.  I have followed the pinoutB from this link :http://www.arduino.cc/playground/Code/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

bperrybap

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:
http://arduino.cc/forum/index.php?topic=88878.0
(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:

Quote
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

carrieklchow

Good Day, Bill:

Thank you so much.  The GLCDdiags finally works :)

cc

Go Up