View previous topic :: View next topic |
Author |
Message |
leevise
Joined: 05 Aug 2010 Posts: 89
|
how to use the <GLCD.C>driver ? |
Posted: Fri Aug 12, 2011 2:10 am |
|
|
hello everyone,
I use the 12864LCD (ST7920) to display the character, but I don't how to use the <GLCD.C>driver. My code pre-set as follow:
Code: |
#include <18f452.h>
#fuses HS,NOWDT,PUT,NOPROTECT
//#device ADC = 10
//#include <string.h>
#use delay(CLOCK=10000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,parity=N,bits=8)
//#use i2c(MASTER,SDA=PIN_C4,SCL=PIN_C3,ADDRESS=0X9A,FORCE_HW)//I2C
#define PORTA 0xF80
#define PORTB 0xF81
#define PORTC 0xF82
#define PORTD 0XF83
#define GLCD_E PIN_A5 //使能端口RA
#define GLCD_DI PIN_A2 //RS端口
#define GLCD_RW PIN_A3 //读写命令端口
#define GLCD_RST PIN_B3 //reset
#define GLCD_CS1 PIN_A1 //CS
#include <GLCD.C>
void main()
{
char te[30]="HELLO WORLD"; //
delay_ms(100);
glcd_init(ON);
glcd_fillScreen(OFF);
glcd_text57(3,8,te,1,ON); //
}
|
but it doesn't work ?
why ?
who can give me a sample with <GLCD.C>driver? |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Fri Aug 12, 2011 3:17 am |
|
|
if I need set the PORTA ? (pre-define the RA is not AD) |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Fri Aug 12, 2011 6:12 pm |
|
|
pls give me a sample ! thank you very much! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 12, 2011 7:25 pm |
|
|
Quote: | I use the 12864LCD (ST7920) to display the character,
|
Post a link to the actual LCD module that you are using (not just the
ST7920 controller). For example, this LCD uses that controller:
http://www.crystalfontz.com/product/CFAG12864JTMITT
If that's the one you use, then tell us. Or if it's a different company
and part number, then post a link to it. |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Mon Aug 15, 2011 2:54 am |
|
|
PCM programmer wrote: | Quote: | I use the 12864LCD (ST7920) to display the character,
|
Post a link to the actual LCD module that you are using (not just the
ST7920 controller). For example, this LCD uses that controller:
http://www.crystalfontz.com/product/CFAG12864JTMITT
If that's the one you use, then tell us. Or if it's a different company
and part number, then post a link to it. |
Sir, my LCD is same with your example LCD.
I check all the data (compare mine with yours).
pls give me an example use the <GLCD.C> |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Aug 15, 2011 8:29 pm |
|
|
Hi,
Are you sure it's the same? Your code shows a pin called "CS1" which does not exist on that Crystalfontz GLCD, but is found on many other GLCD's. I think you need to post a schematic, or at the very least a complete listing of pin-to-pin connections you've made between the PIC and the GLCD. Also, tell us how the PIC and GLCD are powered. Finally, show/tell us what you have connected to the GLCD contrast pin.
John |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Tue Aug 16, 2011 7:01 am |
|
|
ezflyr wrote: | Hi,
Are you sure it's the same? Your code shows a pin called "CS1" which does not exist on that Crystalfontz GLCD, but is found on many other GLCD's. I think you need to post a schematic, or at the very least a complete listing of pin-to-pin connections you've made between the PIC and the GLCD. Also, tell us how the PIC and GLCD are powered. Finally, show/tell us what you have connected to the GLCD contrast pin.
John |
OK, I post the LCD PIN graph. It is as follow:
Code: | 1 vss--- Groud
2 vdd--- power supply
3 vlcd-- no connection
4 rs(cs)---H/L H:data L:instruction code
5 rw(sda)--H/L H:Read L:Write
6 E(sclk)--H,H->L Enable Signal
7 DB0 --- 14 DB7 Data Bus Line
15 PSB----H/L H:Parallel Mode L:serial mode
16 NC
17 RST--- Reset,ACTIVE LOW
18 VOUT---NC NO connection
19 LED+ LED backlight power supply
20 LED-
|
|
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Aug 16, 2011 8:22 am |
|
|
Hi,
That's not really what I was asking for. You mostly just posted the pin definitions from the datasheet. What I'd like to see is what PIC pins connect to what GLCD pins. Show us a pin-to-pin map of these connections.
Also, having nothing connected to pin #3 of the GLCD is a mistake. The datasheet shows a variable resistor (pot) connected between pin #18 (Vout), and pin #3 (Vlcd). Your GLCD won't display anything without this connection.
Thanks,
John
PS The datasheet for that display is really poor, but I think it's adequate to get the display working! |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Tue Aug 16, 2011 9:26 am |
|
|
ezflyr wrote: | Hi,
That's not really what I was asking for. You mostly just posted the pin definitions from the datasheet. What I'd like to see is what PIC pins connect to what GLCD pins. Show us a pin-to-pin map of these connections.
Also, having nothing connected to pin #3 of the GLCD is a mistake. The datasheet shows a variable resistor (pot) connected between pin #18 (Vout), and pin #3 (Vlcd). Your GLCD won't display anything without this connection.
Thanks,
John
PS The datasheet for that display is really poor, but I think it's adequate to get the display working! |
First, thank you very much!
I set the PIC PIN --- LCD PIN as follow:
Code: |
E PIN_A5
RS PIN_A2
RW PIN_A3
RST PIN_B3
PSB PIN_A1
Data bus ----PORTD
|
I don't know the CS1&CS2 of <GLCD.C>driver. What are they ?
My lcd is not these pins. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 16, 2011 1:55 pm |
|
|
Quote: |
Sir, my LCD is same with your example LCD.
I check all the data (compare mine with yours).
pls give me an example use the <GLCD.C>
|
You are not using the CrystalFontz lcd.
Post a link to the website for your LCD. Post the manufacturer and
model number of your LCD. |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Tue Aug 16, 2011 7:08 pm |
|
|
PCM programmer wrote: | Quote: |
Sir, my LCD is same with your example LCD.
I check all the data (compare mine with yours).
pls give me an example use the <GLCD.C>
|
You are not using the CrystalFontz lcd.
Post a link to the website for your LCD. Post the manufacturer and
model number of your LCD. |
I post the LCD company's web as follow:
http://www.gptlcm.cn/EN/list.asp?proname=OCMJ4X8C-15
this LCD can display Chinese character. |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Wed Aug 17, 2011 7:02 am |
|
|
Hi guys, I check the HDM64GS12 LCD datasheet (because the <GLCD.C> using for this chip): http://html.alldatasheetcn.com/html-pdf/105531/ETC/HDM64GS12/56/1/HDM64GS12.html
I found some differences between this LCD with my used LCD(ST7920), so who can give me a example driver that can support my LCD (ST7920 controller), or how to modify <GLCD.C>driver in order to my LCD ?
Thank you very much!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 17, 2011 2:59 pm |
|
|
Now that you've given your LCD part number, I can see your thread
from about 1 year ago where you're asking for the same thing.
You want us to write a CCS driver for you:
http://www.ccsinfo.com/forum/viewtopic.php?t=43324
If someone had one, they would have posted it ! |
|
|
leevise
Joined: 05 Aug 2010 Posts: 89
|
|
Posted: Wed Aug 17, 2011 7:36 pm |
|
|
PCM programmer wrote: |
Now that you've given your LCD part number, I can see your thread
from about 1 year ago where you're asking for the same thing.
You want us to write a CCS driver for you:
http://www.ccsinfo.com/forum/viewtopic.php?t=43324
If someone had one, they would have posted it ! |
Yes, but I complete my code and it is ok. This time, I want to use the <GLCD.C>driver, but I don't understand this driver, so when I use it, I don't know how to use.
I found this driver maybe can't support my LCD module, because my LCD use the ST7920 chip, but also my LCD doesn't have the CS1 & CS2 pin.
So I think I must do a driver for my LCD, at present, I am doing this work, when I finish it, I will post the driver in the forum.
Thank you everyone ! Thank you for your help !!!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19561
|
|
Posted: Thu Aug 18, 2011 2:03 am |
|
|
I have a 'suspicion', that some compiler versions actually b***er up the stack limit testing. Had some code that exhibited an arithmetic 'oddity', rather like this, and with no reset occurring. Expanded the stack and all was well.
I think the default settings from some versions of the compiler, allow the stack to grow over areas that are being used by the compiler for other things, without stack limits being triggered.... A caveat.
Best Wishes |
|
|
|