View previous topic :: View next topic |
Author |
Message |
LoVeLy
Joined: 21 May 2012 Posts: 11
|
GLCD coding??? |
Posted: Mon May 21, 2012 3:46 pm |
|
|
Can anyone post a simple and complete coding on how to display a text on glcd screen (128x64) by using pic18f4525...
please..really need help. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Mon May 21, 2012 6:21 pm |
|
|
Well it's NOT simple .... in fact impossible unless you supply us with the mfr/make/model/specs/datasheet for the GLCD you're trying to use.
There is NO one standard driver that will work on every GLCD.
GLCD to me means a Graphical Liquid Crystal Display that is addresable on a pixel by pixel level. However it could be monochrome or RGB, it might have built in drivers for text, 'simple' graphics (line, circle,etc.), the options are endless.....also HOW does it interface to the PIC ? I2C,SPI,OW,4bit,8bit,??
You might try one of the examples that CCS kindly supplies located in either the 'drivers' or 'examples' folder. Also search the 'code library' forum here as you're NOT the first one who has asked such a generic question. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Tue May 22, 2012 8:59 am |
|
|
temtronic wrote: | Well it's NOT simple .... in fact impossible... |
Why?
You don't have the magic guess sphere?
Just kidding, I know what you mean. ;) _________________ Electric Blue |
|
|
LoVeLy
Joined: 21 May 2012 Posts: 11
|
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed May 30, 2012 6:48 am |
|
|
Hi,
The datasheet does not say so explicitly, but that display *appears* to use the KS0108 chipset. The \Examples folder has a driver that should work with that display. Take a look at 'GLCD.c'.
That driver allows you to display text, and draw simple graphics on the display. Search the forum archives for lots of examples.
John |
|
|
LoVeLy
Joined: 21 May 2012 Posts: 11
|
|
Posted: Fri Jun 08, 2012 1:38 am |
|
|
is there any problem if i connect :
DB0 of glcd -----> RD7 of pic
DB1 -----> RD6
DB2 -----> RD5
DB3 -----> RD4
DB4 -----> RD3
DB5 -----> RD2
DB6 -----> RD1
DB7 -----> RD0 |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri Jun 08, 2012 5:07 am |
|
|
no....
providing you alter your driver accordingly..
and
providing that your project doesn't require any of the onboard peripherals associated with those pins.
since you're the 'project engineer', you've got 100 % control of ALL aspects of the job. |
|
|
LoVeLy
Joined: 21 May 2012 Posts: 11
|
|
Posted: Sat Jun 09, 2012 3:02 am |
|
|
I've successful displayed an image on glcd
but I still don't know how to display a text on glcd.
Can anyone kindly help me?? |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Sun Jun 10, 2012 9:47 am |
|
|
Hi,
Your post really makes no sense! It's like saying "I've mastered differential equations, but I'm still having trouble with basic addition"..... Most users find that placing text on a GLCD is (relatively) easy, while displaying images is quite a bit more difficult, and yet you report exactly the opposite....
I suggested that your display *might* be KS0108 based. Was that true? What driver are you using with the display? The CCS supplied driver, 'GLCD.c', that I previously mentioned has a function (glcd_text57) to display text on the GLCD. What else do you need?
Is this a "real" hardware project, or a Proteus simulation?
John |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Mon Jun 11, 2012 9:30 am |
|
|
As far I know, the KS0108 have no commands for text, you must to draw the text, so if you can draw an image you can draw text. _________________ Electric Blue |
|
|
LoVeLy
Joined: 21 May 2012 Posts: 11
|
|
Posted: Tue Jun 12, 2012 7:29 am |
|
|
i'm using glcd_text57 in order to display text..
i can display the text but the text is not smooth..
the pixel is scattered..
is there any instruction instead of using glcd_text57?? |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Jun 12, 2012 8:00 am |
|
|
LoVeLy,
Once again, what driver are you using, and is this a "real" hardware project, or a simulation?
Tell us what driver you are using (if it's a CCS driver, don't post it, we all already have it), and post your program that uses this driver. If you don't do these minimum steps, we can't help you here.
John |
|
|
LoVeLy
Joined: 21 May 2012 Posts: 11
|
|
Posted: Tue Jun 12, 2012 8:23 am |
|
|
I'm using KS0108 driver and this is the real hardware.
This is my coding.
Code: |
#include <18F4525.h>
#use delay(clock=20M)
#fuses HS, NOWDT, NOLVP, NOPROTECT
//#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7, PARITY=N, ERRORS)
#include <stdlib.h>
#define GLCD_CS1 PIN_B0 // Chip Selection 1
#define GLCD_CS2 PIN_C5 // Chip Selection 2
#define GLCD_DI PIN_B1 // Data or Instruction input
#define GLCD_RW PIN_C3 // Read/Write
#define GLCD_E PIN_C2 // Enable
#define GLCD_RST PIN_C4 // Reset
#include <HDM64GS12.c>
#include <graphics.c>
//#use standard_io(A)
void main()
{
//int32 TEMP1,TEMP2;
char text1[20],text2[20];
while(true)
{
glcd_init(ON);
glcd_fillScreen(OFF);
delay_ms(200);
sprintf(text1,"HEALTH CARE");
glcd_text57(5,15,text1,2,ON);
sprintf(text2,"MONITORING");
glcd_text57(10,35,text2,2,ON);
}
} |
|
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Jun 12, 2012 10:06 am |
|
|
Hi,
I tested your code, and it basically works. You are constantly rewriting the GLCD display from within your While() loop, and that might be causing the problem you are experiencing. You are also setting the text 'size' parameter to 2 which will scale the displayed characters by a factor of two. The glcd_text57 routine just blows up each character to the size specified, based on the data for a character of scale 1. The result is a larger character, but very often one that doesn't look very nice. If you need larger characters, the best way to get them is to define a new character set. For example, I have a glcd_test14X21 routine, and custom font data, that displays large characters very nicely.
If you think something else is going on, please post a clear (in focus!) photo of your display to illustrate the problem for us!
Code: |
void main()
{
char text1[20],text2[20];
glcd_init(ON);
glcd_fillScreen(OFF);
delay_ms(200);
sprintf(text1,"HEALTH CARE");
glcd_text57(5,15,text1,2,ON);
sprintf(text2,"MONITORING");
glcd_text57(10,35,text2,2,ON);
While(1){}
}
|
John |
|
|
LoVeLy
Joined: 21 May 2012 Posts: 11
|
|
Posted: Wed Jun 13, 2012 4:22 am |
|
|
I think what E_Blue said is right.
This glcd only can display image.
So I need to draw the text.
But how to convert the text that I draw in glcd format?? |
|
|
|