Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

need help in glcd

Status
Not open for further replies.

darsin

New Member
anyone please help me in Graphic LCD 128x128A with the KS0108B
**broken link removed**
please please:(
 
well actually i had found the sample code from pommie. I tried his code in my glcd but the only thing different is the size. His glcd is 128x64 whereas mine is 128x128. I straight use his code to try in my glcd is it correct?

my glcd have 4 chip select and his glcd has 2 chip select. so it will just only on my cs1 and cs2 in my gcd right?

but then my glcd can not display even a pixel. some times it will display some but could not get exactly the same result like pommie's graphic.
 
Unfortunately, when I wrote that demo code I was a little lazy and referred to some of the ports in code and so this required additional changes to be made throughout the code. I've attached a newer version of that code that should only require the #defines in GLCD.h to require modifying in order to work on different hardware. As for controlling the other two CS lines, I think the code I posted in your other thread should work.

Mike.
Edit, please see further down the thread for a corrected version of the code.
 
Last edited:
i changed the chip select code.
but still nothing display in my glcd
code:
void WritePosition(void){
b_GLCD_GCS1=0;
b_GLCD_GCS2=0;
b_GLCD_GCS3=0;
b_GLCD_GCS4=0;
if (YPos>63){
if(XPos>63){
b_GLCD_GCS4=1;
b_GLCD_GCS3=1;
}
else{
b_GLCD_GCS2=1;
b_GLCD_GCS1=1;
}
}
GLCD_Write_Cmd(0x40+(XPos&0x3f)); //column=0
GLCD_Write_Cmd(0xb8+((YPos&0x3f)>>3)); //row=0
}

and please check this for me
code:
void Wait_Not_Busy(void){
TRIS_Data=0xff;
b_GLCD_RS=0;
b_GLCD_RW=1;
if (b_GLCD_GCS1==1 && b_GLCD_GCS2==1){
b_GLCD_GCS1=0;
while (GLCD_Read()&0x80);
b_GLCD_GCS1=1;
b_GLCD_GCS2=0;
while (GLCD_Read()&0x80);
b_GLCD_GCS2=1;
}

if (b_GLCD_GCS3==1 && b_GLCD_GCS4==1){
b_GLCD_GCS3=0;
while (GLCD_Read()&0x80);
b_GLCD_GCS3=1;
b_GLCD_GCS4=0;
while (GLCD_Read()&0x80);
b_GLCD_GCS4=1;
}
else{

while (GLCD_Read()&0x80);
}
TRIS_Data=0x00;
}

please help me~:eek:
 
Forget about getting it to work with the 4 CS pins and just concentrate on getting it to work with 2. Make sure the unused CS pins are held low at all times.

Have you changed the #defines in the GLCD.h file?

Mike.
 
yes but i just added:
#define b_GLCD_GCS3 LATAbits.LATA0
#define b_GLCD_GCS4 LATAbits.LATA1
and
#define b_TRIS_GCS3 TRISAbits.TRISA0 //GCS3
#define b_TRIS_GCS4 TRISAbits.TRISA1 //GCS4

is it any other #defines need to change too??
my backlight of anod and katod already connected to the Vdd and Gnd respectively
so i don't need to connect to the port right?
 
Last edited:
I just checked the code I posted earlier and it was the wrong version. Could a mod please delete it.

Here is the original code with the required mods so you should just have to change GLCD.h Sorry about the earlier confusion.

Mike.
PS, What happened to the edit period becoming 1 week?
 

Attachments

  • GLCD.zip
    31.6 KB · Views: 656
I just checked the code I posted earlier and it was the wrong version. Could a mod please delete it.

Here is the original code with the required mods so you should just have to change GLCD.h Sorry about the earlier confusion.

Mike.
PS, What happened to the edit period becoming 1 week?

hi Mike,
Electromaster confirmed its now 1 hour, for a longish trial period.
 
pommie my glcd is still not working
it display nothing!:(
i checked all the connection and i'd grounded my cs3 n cs4...

p/s:i wanna cry~~~
 
Can you post a circuit diagram?

Are you using an ICD2 or a Pickit2, if so can you pause it and see where it is stopping?

Mike.
 
Im now locking this thread. For the time being the edit time is 60 minutes. We will see how this goes for a while.
__________________
▌ Electro Tech Online Owner

hi Mike,
Following that thread link you posted, gave me the above as at the 13th July.

I am sure its 60 mins.
 
this is my schematic, others i a bit lazy to draw it out.
i'm using ICD2 to program...
is it the problem is on my potentiometer part?
i'm using 10k...
 

Attachments

  • graphic lcd.JPG
    graphic lcd.JPG
    134.4 KB · Views: 448
Last edited:
I can't find a data sheet for that display so I'm not sure but I would think that Vout should go to the top of the potentiometer. Have you changed the 16 #defines in GLCD.h to match your circuit?

If you setup your ICD2 as debugger and hit pause after it has run, which line does it stop on?

Mike.
 
BTW, where is your crystal?

If you don't have one then that is the problem.

It can be changed to the internal oscillator if needed.

Mike.
edit, if this is your problem then you need to change the following bits in main.c
Code:
#include <p18f4550.h>
#include <GLCD.h>

#pragma config WDT = OFF, LVP = OFF, [COLOR="Blue"]FOSC = INTOSCIO_EC[/COLOR]

const rom unsigned char Logo[];

void main (void){
unsigned char i;
[COLOR="blue"]    OSCCON=0x70;[/COLOR]               //added
    ADCON1=0x0f;               // all digital
    CMCON=7;                   // no comparators
    Init_GLCD();
 
Last edited:
yes! i changed it. the data sheet i had posted in the 1st post.
I connected 20MHz crystal on my circuit board already.
i just using the ICD2 programmer but not the debugger.
 
Try changing it to the internal oscillator anyway. Your crystal may not be starting up correctly. You don't need to change your circuit, just the code.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top