View previous topic :: View next topic |
Author |
Message |
jony john
Joined: 07 Jun 2010 Posts: 4 Location: malaysia
|
glcd problem |
Posted: Thu Jan 13, 2011 7:26 pm |
|
|
hye all,
I need help regarding to glcd please.
I use 18F452, 20MHz, glcd pin connection as below:
Code: |
GLCD Pin connections: ////
//// (These can be changed as needed in the following defines). ////
//// * 1: VSS is connected to GND ////
//// * 2: VDD is connected to +5V ////
//// * 3: V0 - LCD operating voltage is connected from a 20k Ohm POT////
//// * 4: D/I - Data or Instruction is connected to B2 ////
//// * 5: R/W - Read or Write is connected to B4 ////
//// * 6: Enable is connected to B5 ////
//// *7-14: Data Bus 0 to 7 is connected to port d ////
//// *15: Chip Select 1 is connected to B0 ////
//// *16: Chip Select 2 is connected to B1 ////
//// *17: Reset is connected to C0 ////
//// *18: Negative voltage is also connected to the 20k Ohm POT ////
//// *19: Positive voltage for LED backlight is connected to +5V ////
//// *20: Negavtive voltage for LED backlight is connected to GND
My coding are as below:
#include <18F452.H>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#include "GLCD.c"
void main()
{
//int x2=0,y2=0;
char text[30]="HELLO WORLD"; //
glcd_init(ON);
delay_ms(500);
glcd_fillScreen(OFF);
//while(1)
//{
glcd_text57(0,0,text,1,ON); //
//delay_ms(1000);
//}
}
|
What I got from simulation and hardware:
http://img714.imageshack.us/i/96204517.png
Your kind help about this matter are much appreciated. |
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Thu Jan 13, 2011 9:39 pm |
|
|
You did not say if you are using the standard CCS driver, so I will assume so.
The issue here is the driver is written for 4Mhz operation. You are running is at 20Mhz, so the timings are wrong.
Have a look at the driver and you will see some "delay_cycle(1)" lines. Change the delay to the smallest number that works for you. I would start at 10 and workdown.
Maybe there is a better way to fix this, but this has always worked for me.
Mark |
|
|
takumi
Joined: 07 Mar 2009 Posts: 14
|
|
Posted: Wed Jan 19, 2011 1:56 am |
|
|
Tq Markdem, I've learned something from your answer. But how about a GLCD TGL12864E which didn't have any CS pins? Which driver of CCS is suitable?
1. vss
2. vdd
3. vo
4. rs
5. r/w
6. e
7. DB0
8. DB1
9. DB2
10. DB3
11. DB4
12. DB5
13. DB6
14. DB7
15. PSB
16. NC
17. /RST
18. NC
19. LEDK
20. LEDA |
|
|
|