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

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

LCD not working at frequence High speed

Postby Ondra » Fri Feb 17, 2012 5:59 am

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: 3080
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 88 times
Been thanked: 391 times
Contact:

Re: LCD not working at frequence High speed

Postby Steve » Fri Feb 17, 2012 10:59 am

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

Postby Ondra » Fri Feb 17, 2012 2:28 pm

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: 14442
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4505 times
Been thanked: 4186 times
Contact:

Re: LCD not working at frequence High speed

Postby Benj » Fri Feb 17, 2012 4:46 pm

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.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8476
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2435 times
Been thanked: 3487 times
Contact:

Re: LCD not working at frequence High speed

Postby medelec35 » Sat Feb 18, 2012 1:37 pm

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
(15.03 KiB) Downloaded 138 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8476
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2435 times
Been thanked: 3487 times
Contact:

Re: LCD not working at frequence High speed

Postby medelec35 » Sat Feb 18, 2012 2:36 pm

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
(12.56 KiB) Downloaded 127 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: LCD not working at frequence High speed

Postby Ondra » Sun Feb 19, 2012 9:22 pm

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: 426
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: LCD not working at frequence High speed

Postby echase » Mon May 28, 2012 12:51 pm

I have a similar LCD problem, see viewtopic.php?f=46&t=10725&p=35439 . I can't get the solutions here to work for me.