Page 1 of 1

LCD not working at frequence High speed

Posted: Fri Feb 17, 2012 5:59 am
by Ondra
Good day all. I recently upgraded a project to the PIC18F46K80, running a 20Mhz. I was having some trouble servicing the Zigbee RX componet. A number of characters were missing or being dropped. I decided to change the frequency to 40Mhz using a 10MHz crystal set to PLL enabled. It worked in that I have no problems servicing the Zigbee Rx componet all the cha are coming though as expected. What did happened though is that the LCD screen started showing garbage. I set the speed back to 20Mhz and the screen works fine. I tried every setting there is in the config, nothing works.
I took a look at the defines under the custom component code to. It looks like the device communicates at 9600bps. I'm figuring that the timing must be the issue. Is there a work around for this. I have 2 RS232 ports and a Zigbee device and they are working fine. Thanks in advance.

Ondra

Re: LCD not working at frequence High speed

Posted: Fri Feb 17, 2012 10:59 am
by Steve
Which LCD screen are you using? I suspect that you may need to customise the code for the screen to give additional delays during the low-level communication routines.

Re: LCD not working at frequence High speed

Posted: Fri Feb 17, 2012 2:28 pm
by Ondra
I suspect that you may need to customise the code for the screen to give additional delays during the low-level communication routines.
I don't know how to do this. Here is a link to the datasheet. May be with a quick glance you can see if this can be done with device. If not please give another alternative solution. Thanks in advance

http://www.crystalfontz.com/products/do ... ATMIJP.pdf

Re: LCD not working at frequence High speed

Posted: Fri Feb 17, 2012 4:46 pm
by Benj
Hello,

Select the LCD component on the panel and then click custom code.

Edit the definesCode function

Then find this section.

#ifdef _BOOSTC
#define %s_DELAY delay_10us(10)
#endif

and try increasing the delay values slightly maybe to 12 or 15.

eg

#ifdef _BOOSTC
#define %s_DELAY delay_10us(15)
#endif


The top delay under the ifdef BOOSTC should be the one that is being used if you are using the default Flowcode compiler.

Re: LCD not working at frequence High speed

Posted: Sat Feb 18, 2012 1:37 pm
by medelec35
Ondra wrote: If not please give another alternative solution. Thanks in advance
Hi Ondra,
Here is an alternative soultion.
I have altered PIC_LCD.c file to automatically use on any target device a value of delay_10us(15) if Clock Speed is set to 30MHz or higher, Otherwise delay_10us(10) will be used.
The (15) is based on Bens suggestion as he is the components expert, and I'm not.
I guessed the limits 30MHz.

If you want to give this a go then make a copy of PIC_LCD.c
which is located in:
C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\Components
If 64 bit windows
or
C:\Program Files\Matrix Multimedia\Flowcode V4\Components
if 32 bit windows

Replace original with attached file.

We could solve this between us, but there may be a bit of trial and error involved on final value to use in the delay (That's if you don't mind testing of course).

Martin

Re: LCD not working at frequence High speed

Posted: Sat Feb 18, 2012 2:36 pm
by medelec35
Just noticed you are a V5 user, so here is the V5 version which goes into:
C:\Program Files (x86)\Flowcode\v5\Components\
or
C:\Program Files\Flowcode\v5\Components\

Martin

Re: LCD not working at frequence High speed

Posted: Sun Feb 19, 2012 9:22 pm
by Ondra
Thanks Martin.
I tried the recommendations given by Ben. I also tried playing with other values. Nothing worked. I was running at 40Mz. I went with 40 to try to overcome an issue of characters being dropped from my Zigbee connection. I implemented some error checking on the RX data side. Changed the crystal again this time to the old favorite 19.6608Mrz. Now all's well. Thanks for your help.

Ondra

Re: LCD not working at frequence High speed

Posted: Mon May 28, 2012 12:51 pm
by echase
I have a similar LCD problem, see http://www.matrixmultimedia.com/mmforum ... 25&p=35439 . I can't get the solutions here to work for me.