LCD not working at frequence High speed

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

LCD not working at frequence High speed

Post 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

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: LCD not working at frequence High speed

Post 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.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: LCD not working at frequence High speed

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LCD not working at frequence High speed

Post 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.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD not working at frequence High speed

Post 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
Attachments
PIC_LCD.c
Unofficial Modification
(14.19 KiB) Downloaded 320 times
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD not working at frequence High speed

Post 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
Attachments
FC5_PIC_LCDDisplay.c
Unofficial modification
(11.88 KiB) Downloaded 307 times
Martin

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: LCD not working at frequence High speed

Post 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

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: LCD not working at frequence High speed

Post 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.

Post Reply