General discussion relating to the library modules supplied with the compiler
Moderators: David Barker, Jerry Messina
-
CS
- Posts: 127
- Joined: Thu Nov 02, 2006 9:14 am
Post
by CS » Sat Nov 04, 2006 5:44 pm
Hi Steven,
like you wished here the result with the altered module for the KS0108.
I have added the following line to my project:
The main problem wasn't solved. At power up I have to reset the PIC before the programm runs perfect.
Best wishes
CS
-
Steven
- BETA Tester
- Posts: 406
- Joined: Tue Oct 03, 2006 8:32 pm
- Location: Cumbria, UK
Post
by Steven » Sat Nov 04, 2006 6:07 pm
Could you post the full code you are now using?
Thanks,
Steven
-
CS
- Posts: 127
- Joined: Thu Nov 02, 2006 9:14 am
Post
by CS » Sat Nov 04, 2006 6:21 pm
Hi Steven,
here you are:
Code: Select all
Device = 18F452
Clock = 20
#option GLCD_RS = PORTB.4
#option GLCD_EN = PORTB.6
#option GLCD_RW = PORTB.5
#option GLCD_CS1 = PORTB.3
#option GLCD_CS2 = PORTB.2
#option GLCD_RST = PORTB.7
#option GLCD_INVERT_CS = true
#option GLCD_INIT_DELAY = 200
Include "GLCD.bas"
'Include "FixedFont.bas"
'Include "Arial.bas"
'Include "Garamond.bas"
'Include "Tahoma.bas"
'Include "Verdana.bas"
'Include "Times.bas"
GLCD.Cls
GLCD.SetFont(Fixed)
GLCD.WriteAt(4,2,"System Font")
GLCD.SetFont(ArialBold)
GLCD.WriteAt(4,10,"Arial Font")
GLCD.SetFont(GaramondBold)
GLCD.WriteAt(4,20,"Garamond Font")
GLCD.SetFont(TahomaBold)
GLCD.WriteAt(4,30,"Tahoma Font")
GLCD.SetFont(VerdanaBold)
GLCD.WriteAt(4,40,"Verdana Font")
GLCD.SetFont(TimesBold)
GLCD.WriteAt(4,50,"Times New Roman")
CS
-
Steven
- BETA Tester
- Posts: 406
- Joined: Tue Oct 03, 2006 8:32 pm
- Location: Cumbria, UK
Post
by Steven » Sat Nov 04, 2006 6:43 pm
Try increasing the GLCD_INIT_DELAY - 700 worked fine on my EasyPIC3. You just have to give the display time to settle before initialising it.
This will only be an issue at power-up, hence it works OK when you reset it.
-
CS
- Posts: 127
- Joined: Thu Nov 02, 2006 9:14 am
Post
by CS » Sat Nov 04, 2006 8:36 pm
Hi Steven,
Increasing the GLCD_INIT_DELAY to 700 didn't solve the problem. I thing we have different EasyPic3 Revisions.
In the Datasheet from the PIC there are some hints to build an external power on reset circuit. That should solve the problem. (It would be nice to have a software solution but anyway most importend is that the PIC runs like I expected.
Thanks
CS
-
xor
- Posts: 286
- Joined: Sun Nov 05, 2006 1:15 pm
- Location: NYC
-
Contact:
Post
by xor » Mon May 28, 2007 10:38 pm
CS wrote:I have added the following line to my project:
I've started work with the KS0108 and noticed that the KS0108 module still doesn't show this option. Is there a default value somewhere that I missed?
-
Steven
- BETA Tester
- Posts: 406
- Joined: Tue Oct 03, 2006 8:32 pm
- Location: Cumbria, UK
Post
by Steven » Tue May 29, 2007 6:49 am
I've just checked my new install of the compiler to make sure it's there. There is not a default option at the top, since the library only includes the reset pin in it's code if the #option statement is given in the user's code, using compiler directives. Otherwise, the library is unaltered from the original. Check line 83 of the KS0108 library. If it doesn't refer to GLCD_RST then you might not have the latest version of the library - I'll post it here if that is the case. The modifcation is only very small.
Steven
-
xor
- Posts: 286
- Joined: Sun Nov 05, 2006 1:15 pm
- Location: NYC
-
Contact:
Post
by xor » Tue May 29, 2007 1:15 pm
I added the #option to my code to declare the pin, the same as CS's. I didn't see any delcaration assignment for the RST pin in the KS0108 module and there is a compiler test to throw an error message if not valid. Is it not used in some cases?
Code: Select all
// validate RST pin...
#if IsOption(GLCD_RST) And Not IsValidPortPin(GLCD_RST)
#error GLCD_RST, "Invalid option. RST must be a valid port pin."
#endif
-
Steven
- BETA Tester
- Posts: 406
- Joined: Tue Oct 03, 2006 8:32 pm
- Location: Cumbria, UK
Post
by Steven » Tue May 29, 2007 11:39 pm
The RST pin can be tied either high or low - I can't remember which it is... However, on the ME EasyPIC boards, the pin is connected to a port pin, so I added the few extra lines to the library to set it correctly on initialisation. It's not actually used for any purpose by the library. If you have the option, you can just tie it and then not inlcude the #option in your code - this will save you a few bytes.
Steven
-
xor
- Posts: 286
- Joined: Sun Nov 05, 2006 1:15 pm
- Location: NYC
-
Contact:
Post
by xor » Tue May 29, 2007 11:55 pm
Thanks Steven. I understand better.