Problem with frequency and LCD display

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Problem with frequency and LCD display

Post by Mikat »

Does anybody else have problems with 4MHz frequency with lcd display?
At least on displaytech lcd displays,i ant get the display working correct if i set the chip frequency to 4MHz,and use 4MHz xtal,with 8 and 3,27 MHz setting displays work fine,with 4MHz crystal...

So it would been nice to know is the problem in software,or in displaytech displays..

Steve,have you been able to test the hello files what i sent to you.when i asked you about the problem?

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:

Post by Benj »

Hello Mikat

I remember trying to test the LCD's on a 4MHz crystal but we dont happen to have any here to test with. I think I have some 4Mhz crystals at home so I will test later today (prob this afternoon) and let you know the outcome.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Post by Mark »

I am working with a 4MHz crystal at the moment on the HP-488 board and have had no problems with the display. I have also displays working on boards using a 4MHz ceramic oscillator (so some variation around 4MHz), again without any issue using Flowcode.

ps. Going from 8 to 4 Mhz sometimes requires a change from HS to XT mode but 4MHz (3.X?) can sometimes work in HS, however, I assume you are top of that one.

Hope this helps.
Go with the Flow.

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:

Post by Benj »

Mikat what version of flowcode are you using. Also which version is your LCD component. (There should be a version number on the component within flowcode)

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Hi Ben,the flowcode version is 3.0.4.29,and the lcd component version 1.1.0.0...
Mark,the problem is not that pic wont work,code runs fine,and does all else well,but the lcd print is mess...

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:

Post by Benj »

Milkat

Firstly make sure that if you are using a variable string that gets passed to the LCD you need to initailise the value at the start of your program.
Eg. String Manipulation Icon (Str1 = "")

Secondly my LCD component is V1.3. seeing as your Flowcode V3 is up to date I wonder why the componet you have is so old. There is a new patch coming out today or tomorrow. Maybe try removing the LCD component from the components folder and reinstalling Flowcode to see if that helps to refresh the component.

If you are still having problems then I will bring in a 4MHz crystal tomorrow and try it out for myself.
Sorry I didnt get chance to test it today.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Ben,the problem occurs in simple code witch print the word "hello",so the code inludes nothing but lcd start-loop-lcd cursor-and lcd print ascii "hello"...
The code runs fine in 8 ans 3.27..MhHz,but not in 4MHz chip settings...

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:

Post by Benj »

Thats very odd. I have tested your simple flashing hello program at 4MHz and it seems to be working fine. Please send me your programs and I will try to work out what the problem is.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Ben,Steve should have those files,the print hello in 3 different frequencys,8,4and 3,27..MHz,and the 4MHz dont work on me..
Sorry to bother you,beause the problem could be my displays...

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:

Post by Benj »

Yes I have those files. The 4MHz clock settings in flowcode seemed to be still set at 3.27, this may be the source of your problem.

Make sure that in the Chip -> Clock speed menu you set the clock speed to 4000000. Thats a 4 followed by six 0's.

Other then this I have tested the 4MHz file using a 4MHz crystal and a 4MHz ceramic oscillator and both worked fine.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Ben,for me the clock freqs show correct 8,4 and 3,27MHz...
Here is direct copys of those files c-code on start..


3,27MHz

//funktiot
#include <system.h>
#pragma CLOCK_FREQ 3276800





4MHz

//funktiot
#include <system.h>
#pragma CLOCK_FREQ 4000000

8MHz

//funktiot
#include <system.h>
#pragma CLOCK_FREQ 8000000

And the lcd works fine with 3276800 settings and 4MHz xtal,but not at the 4000000 settings..
The problem is kind of strage...
And i am not sure do i have it at the beginning,but in my laptop i have "clean" install,only the beta pwm component,and yhe updates..

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:

Post by Benj »

This is really strange.
What language are you using flowcode in.
Maybe it has something to do with a difference between the language packs.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Hmm..
I am using finnish language..
I am not sure,but it MIGHT be that when i use the demo,with 30 days evaluation code,it was english,and could be that i didnt have that problem..
Maybe i shoud test when the 3.1 arrives,and install it in english...
But this is stange,and even more if the language pack makes that..
By the way,how an i install the update in differen language,the choise might be somewhere in register...

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:

Post by Benj »

You can change the language at any time by selecting

View -> Options

Tick the override language box and then selecting your language.

I will try compiling your code in finnish and see if this affects the running of your prog.

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:

Post by Benj »

Yes it still works fine in Finnish. I think the problem is probably the differency in LCD component version as mine is V1.3. There will be a new patch for flowcode coming out on moday I think. Hopefully this will help solve your problems.

TSchweizer
Posts: 2
Joined: Tue Jan 23, 2007 12:59 pm
Contact:

LCD Compnent Version 1.3

Post by TSchweizer »

How can I become this LCD Compnent Version 1.3. My Flowcode V3 with the new update has only V1.2. And I have the sam problems with 4Mhz Clock.

ALAN_26
Posts: 84
Joined: Sat Apr 29, 2006 3:36 pm
Location: MALTA
Contact:

Post by ALAN_26 »

Hi mikat

I had the same problem but than I discovered that I was compiling the code for a Pic16f72 with the Pic18 compiler .

For Pic16 devises use:
C:\Program Files\Matrix Multimedia\Flowcode V3\boostc\boostc.pic16.flowcode.exe

For Pic18 devises use:
C:\Program Files\Matrix Multimedia\Flowcode V3\boostc\boostc.pic18.flowcode.exe

For me this fixed the problem .

Hope this will be of help .

Regards : Alan cilia .

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

Post by Steve »

Alan,

This seems an unlikely fix. Flowcode automatically chooses the appropriate compiler by replacing the "pic16" / "pic18" text with the correct one. [in fact, I think that compilation will fail if the wrong compiler is launched].

But I suppose it's worth a try. Let me know if it solves the problem with anyone else.

Another thing to try is the oscillator configuration bits. 4MHz can (in theory) work with both HS and XT settings. Again, if this solves the problem, please let me know.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Hmm,seems that problem is not my display...
Steve,could you send me simple code,like print "hello" word,witch is compiled for you flowcode,and works with 4MHz chip settings and 4MHz clock,ill compile it on my flowcode,and test it..
And sent the asm,c and hex files too,so i can compare those in my own..

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Hi Ben,i cheked the files that you sent to me,and compered them files thet i ompile in my flowcode,and foud some differences...
In c code
first

my compile
set_bit(outVal, LCD_5375816_RS);
LCD_5375816_PORT = outVal;
LCD_5375816_DELAY;
set_bit (LCD_5375816_PORT, LCD_5375816_E);
LCD_5375816_DELAY;
clear_bit (LCD_5375816_PORT, LCD_5375816_E);
pt = (in & 0x0f);
LCD_5375816_DELAY;


your compile

set_bit(outVal, LCD_2228972_RS);
LCD_2228972_PORT = outVal;
set_bit (LCD_2228972_PORT, LCD_2228972_E);
LCD_2228972_DELAY;
clear_bit (LCD_2228972_PORT, LCD_2228972_E);
pt = (in & 0x0f);
LCD_2228972_DELAY;







second
My compile

if (mask)
set_bit(outVal, LCD_5375816_RS);
LCD_5375816_PORT = outVal;
LCD_5375816_DELAY;
set_bit (LCD_5375816_PORT, LCD_5375816_E);
LCD_5375816_DELAY;
clear_bit (LCD_5375816_PORT, LCD_5375816_E);
}

And your compile

if (mask)
set_bit(outVal, LCD_2228972_RS);
LCD_2228972_PORT = outVal;
LCD_2228972_DELAY;
set_bit (LCD_2228972_PORT, LCD_2228972_E);
LCD_2228972_DELAY;
clear_bit (LCD_2228972_PORT, LCD_2228972_E);
LCD_2228972_DELAY;
}

Those differences are in display rawsent code,propably you could say what those diffrences are...

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

Post by Steve »

Mika,

The C code from Ben's file is using the latest v1.3 LCD component, and I presume yours is an older version.

Have you tried the 1.3.5 update to see if this solves your problem? Make sure that it updates the LCD component to v1.3.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

I updated in morning,the lcd component is version 1.3,and the compile is done after the update...

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Btw,steve or ben,have you tested the my compiled hello files in 4Mhz clock,does it work on your displays? If not tested,could one of you compile me simply print hello,with your fc3,ill test it on my lcd,without compiling it in my flowcode,it might help find what causes the problen... I cant use the files ben sent,because i dont have 16f88 chip in my girlfriends place.. So compile the file 16f876a or 877a...

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Post by Mikat »

Gentlemen,now this get intresting...
I tested the files from Ben,and those work fine,but sometimes lcd has problem on start,probably beause the there is no delay before lcd start,the lcd still might be in harware reset when the pic runs the start macro...
BUT when i add delay in the start,if its longer than 3ms,the lcd prints a mess...
But if i change the clock settings in flowcode to 3,27 or 8MHz,the delay could be even 1 second,and the display still runs fine...
With 3,27 or 8MHz setting i can start the lcd,have a cup of coffee and start the pic,the lcd works fine,but not on 4MHz settings,if the delay on start is longer than 2-4ms,the print is mess...
And in quick compare seems that there is no differece in asm files,except the delay ms code,so i had to test on different lcd,maybe this is problem on lcd conroller...
Little more,the closest in timings you can get,if set the clock freq to 3970000,this seems to work,but gives 0.75% error on timings..

Could all of them who had this problem,tell what lcd display your are using,and witch conroller it has,mine is Displaytech 204a,and uses samsung ks66u,or eqvalent
But still,this is really strange...

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

Post by Steve »

This does seem strange! The LCD displays we sell use the Samsung KS0066U driver chip.

Perhaps this is a problem specific to your display (maybe there is a bug in the driver chip)?

Please email the problematic files (FCF, C and HEX files) to Ben and he'll see if the problems is replicated on our hardware.

Post Reply