CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem with GLCD

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
falcon1877



Joined: 30 Sep 2012
Posts: 24

View user's profile Send private message

Problem with GLCD
PostPosted: Tue Oct 09, 2012 12:01 am     Reply with quote

Hi every one, I'm testing my project with 18F4550 and GLCD. The problem is ....when I run it on Proteus, it runs correctly, but when I use it with real circuit and real Graphic lcd (128x64b), it doesn't show anything on lcd. I know that the program is running because LCD blink for a few time before stop working, but LCD doesn't show anything (text or bit map image which I set in my program when program start).

I'm using glcd library in drivers folder of CCS. It uses 18 pin without backled (KS0108 based), but my real GLCD has 20 pin with backled (KS0108 based too) so ... this is a problem ???
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 1:29 am     Reply with quote

No surprises then.

Forget Proteus, it doesn't care about layout, power rails, decoupling and it's full of bugs.

Double (triple) check connections, power rails, decoupling next to devices etc.

Read and re-read the data sheet for your LCD. Check for timings and exact details of initialisation sequence.

Mike
falcon1877



Joined: 30 Sep 2012
Posts: 24

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 1:43 am     Reply with quote

@Mike Walne: yeah, I re-checked connection and powers rails so many time from yesterday but I still can't find any solution for this problem .:(
Do you think this problem cause by crystal ??
I'm using external crystal 10MHZ and use PLL to use it at 20MHZ , so that I use this command :
Code:
#use delay(clock = 20000000,crystal = 10000000)

It's right ??
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 1:57 am     Reply with quote

Does a simple LED flasher run at the correct speed?

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19505

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 1:57 am     Reply with quote

No, not right.....

You can't generate a 20MHz clock using the PLL from 10MHz with this chip. In fact you can't legally use 10MHz with the PLL on this chip.....

On the 18F4550, the PLL can only legally be fed with 4MHz. There are dividers available from the oscillator to the PLL, of 1,2,3,4,5,6,10, & 12, so the external oscillator/crystal _has_ to be 4MHz, 8MHz, 12MHz, 16MHz, 20MHz, 24MHz, 40MHz, or 48MHz. No other frequencies are guaranteed to work with the PLL (the last two need external oscillators, not a crystal).

The PLL, then multiples this by 24, to generate a 96MHz clock. The CPU, can then be fed from the crystal frequency /1,/2,/3 or /4, or from the PLL frequency /2,/3,/4. or /6.

So using the PLL on the 4550, assuming you have a legal crystal frequency (from the list above), the CPU can only run at 48MHz,32MHz,24MHz, or 16Mhz.

The only way to run the 4550 at 20MHz, is with a 20MHz crystal. Then run the CPU from the crystal, not the PLL.

Obviously, since your chip is not running at 20MHz, the timings to control the LCD are completely screwed, hence (almost certainly) the failure to operate.

Either switch to 10MHz, change your crystal to 20MHz, or go to one of the legal crystals, and operate the CPU at 16 or 24MHz.

Set the fuses yourself, the permutations are so complex that the compiler can't really sort them out. Not like chips with a simple *4 PLL.

Best Wishes
falcon1877



Joined: 30 Sep 2012
Posts: 24

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 2:20 am     Reply with quote

ok, I'll replace it later, but I think the problem cause by another thing. If it is a crystal problem, I think on the lcd screen must to have at least 1 dot or half image because of wrong crystal. But here I can't show anything on my screen, so that .... I want to ask that every glcd 128x64 based ks0108 can use glcd library of ccs, right ?
I want to make sure that the problem isn't caused by library.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 4:32 am     Reply with quote

Get the hardware right first.

The software can't work with faulty hardware.

Mike
falcon1877



Joined: 30 Sep 2012
Posts: 24

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 9:40 am     Reply with quote

My problem is solved Very Happy I replace all wire and now it works. But I have another question : how can I draw area on screen without run from left to right.
For example : I want to show an image absolutely on screen without run from left to right or from top to bottom (put one by one pixel to screen) Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group