Page 1 of 1

Graphical LCD and four PWM help needed

Posted: Sun Apr 27, 2008 3:00 pm
by WalkOver
Hello the Flowcode community !

I download the latest Flowcode update and I am very happy to see support for new components such as graphical LCD !
I have a question about this, there is no help file available as for others components. Can we get it or it's not available yet ?
Otherwise, with what type of graphical LCD it’s compatible ?

On the other hand, I noticed that some PIC have more than 2 PWM capabilities but Flowcode refuses to add more than 2. How can we solve this problem ? I need four 20Khz pwm but it's today impossible because of my poor C understanding :-(

Sorry for my english and thank you to all the team!

Re: Graphical LCD and four PWM help needed

Posted: Mon Apr 28, 2008 12:43 pm
by Benj
Hello

There is a help file for the graphical LCD. Unfortunatley in our rush to release the next update for Flowcode we forgot to include it. So instead I have attached it to this post. The Graphical LCD component is currently only compatible with our Nokia E-Block display but we soon hope to include the B&W common displays too.

Unfortunatley Flowcode can only handle up to 2 PWM channels at the moment. You can always get 2 PWM working using the Flowcode component and then use something like a timer interrupt to bit bang the other two channels.

Re: Graphical LCD and four PWM help needed

Posted: Tue Apr 29, 2008 10:58 am
by WalkOver
Thank you very much for your quick response.

What's the Nokia graphic display reference ?

I see what I can do with interruptions, I do not mastered it yet!

Thanks again.

Re: Graphical LCD and four PWM help needed

Posted: Tue Apr 29, 2008 11:03 am
by Benj
Hello

The Nokia Graphics display refers to this product.

http://www.matrixmultimedia.com/product ... PHPSESSID=

Re: Graphical LCD and four PWM help needed

Posted: Thu May 29, 2008 10:55 pm
by Mikat
Is there any way to get bigger font on that gcld,i mean bigger than double size? I think that i have played the glcd component for while ago and managed to get really large font (like 25x40 pixel),but now i cant remember how...

Re: Graphical LCD and four PWM help needed

Posted: Fri May 30, 2008 9:31 am
by Benj
Hello Mikat

I think you should be able to edit the gFXLCD_Code.c file found in the Flowcode V3/Components directory. You should just have to change the width and height constants in the print string function.

Re: Graphical LCD and four PWM help needed

Posted: Fri May 30, 2008 9:50 am
by Mikat
Ok,i try to do that.. How about the writing in the display,is there other way than print number and the before print a new number in same position,clear the display? Because thet is quite slow,cant do that with fast changing value...
I might be blind,but at fast look i didnt find those font size values...

Re: Graphical LCD and four PWM help needed

Posted: Fri May 30, 2008 11:34 am
by Benj
Hello Mikat

Yes you can set the foreground and background colours to white (or whatever background colour you are using) and then simply draw a small box over the value you wish to overwrite. Alternatively you can just write the value in the same position keeping the transparancy setting off and then add a few spaces to the end so that previous values will always get overwritten even if they were longer. I hope this makes sense.

Here is the start of the Print routine. You can see the width and height variables being assigned.

Code: Select all

    char xpix, ypix, pos_Str, length_Str, count, xcount, ycount, height, width, i;
    char Fontwidth = 1;                //First we assume small font
    char Fontheight = 1;

    char temp[6];
    temp[5] = 0x00;                        //Spacing Line

    length_Str = strlen(String);       //Get length of string

    if (Font == 1)                     //Double Height Sizes //Double Width
    {
        Fontwidth = 2;
    }
    if (Font == 2)                         //Double Height and Width Sizes
    {
        Fontwidth = 2;
        Fontheight = 2;
    }
    if (Font == 3)                         //Double Height Sizes
    {
        Fontheight = 2;
    }

Re: Graphical LCD and four PWM help needed

Posted: Fri May 30, 2008 11:54 am
by Mikat
Ok,that transparency was the "problem",but printing is still slow,in font size 6 two number value printing takes at least 1 second... Is that "normally",or is my harware acting weird...
The harware is some bulk display,and sparkfun carrier boar...

Re: Graphical LCD and four PWM help needed

Posted: Fri May 30, 2008 4:23 pm
by Benj
Hello Mikat

No its definatley shouldnt take that long, it takes about that long to clear the entire display here. I had a PICmicro here running on a 19.6608MHz clock creating a graphical charting application here and it was nice and quick. Printing out 2 charaters should be almost instant. What clock speed are you using and does this speed tally with the speed defined in Flowcode. Also make sure you are using the XTAL mode of operation.

NB Simulation speed may differ from hardware speed. Just incase you are going off the Flowcode simulation.

Re: Graphical LCD and four PWM help needed

Posted: Fri May 30, 2008 4:51 pm
by Mikat
I am using the 18f4685 in its own internal oscillator,config at 0x7e,so it should be at 8Mhz... Maybe i should test at external oscillator... Tested at 20MHz,no change..

Re: Graphical LCD and four PWM help needed

Posted: Mon Jun 02, 2008 10:16 am
by Mikat
Ben,could it cause the problem,that i drive the display directly on pic,so the pic is running at 3,3v and the display is connected directly on pic porta...

Re: Graphical LCD and four PWM help needed

Posted: Mon Jun 02, 2008 12:17 pm
by Benj
Hello Mikat

Maybe its worth your while creating a simple LED flasher app that will flash every second. This will show you if the clock speed is correct. Sound like your clock frequency is much slower then expected. Also running the LCD directly off the port is fine.

Re: Graphical LCD and four PWM help needed

Posted: Mon Jun 02, 2008 1:44 pm
by Mikat
Ok. I check the clockspeed,it could be really something else (maybe the chip is running some kind failsafe clock),because i can run the display even if i set the clockspeed at 32KHz in the flowcode.. If the chip runs at 20MHz,and the timings are calculated on 32KHz frequency,the display timings are really fast...
Tested,the chip runs right clockspeeed,i dont get this...
I check the timings at scope,the sclk signal seems to be 0,25us high and 0,25us low,and the sda clock was 4us hig and 4us low,if i calculated right,that gives 2MHz clock and 100Khz dala clock,is the timings ok?
When i look those timings at the sope,there is no difference if i set the clockspeed 1 or 20MHz in flowcode,or change the actual speed of the mcu,the sclk and sda timings stays allways the same??
By the way,how is the ks108 glcd project going?

Re: Graphical LCD and four PWM help needed

Posted: Tue Jun 03, 2008 1:44 pm
by Mikat
Hello. I tested that glcd at second display,this one probably does have different controller (the ontroller die size is much smaller),but the problem is same,priting the number at font size 5 takes at least 1-1.5 seond per number...
Everythin what i print,prints out correctly right,but very slow... Any ideas?

Re: Graphical LCD and four PWM help needed

Posted: Tue Jun 03, 2008 4:22 pm
by Mikat
Guys,how that serial clock it done in that gld component?
Because it seems that its not bonded on flowcode clock settings,but instead the pic real clockspeed...
The clockspeed value dont hange anything on the timings of the serial bus,but changing the xtal will change the timings;even if i set the clockspeed matching the actual speed in flowode....
Does it use some pic internal timer or clock source?

Re: Graphical LCD and four PWM help needed

Posted: Tue Jun 03, 2008 5:04 pm
by Benj
Hello Mika

Probably best to get the clock speed right. The Flowcode clock speed setting is just used by timings etc. It has no relevance over the actual speed of the hardware clock. You probably have to set the chip to XTAL mode via the Chip - > Configuration settings. This should assign the hardware clock to use the crystal. The clock speed variable in Flowcode should be set to match the value of the crystal.

I would create the following to test for correct clock speeds.

Loop while 1
{
output 1
delay 1s
output 0
delay 1s
}

This way you can be sure that both Flowcode and the hardware are configured correctly if you get a flasher with frequency of 1/2 hz.

Re: Graphical LCD and four PWM help needed

Posted: Wed Jun 11, 2008 3:39 pm
by Mikat
Back to the glcd bus once again..
Seems that the serial bus is "driven flat out",so the serial clock is the pic clockspeed by divider of 4,and probably all the delays are done other way than delay (nop command?),so it seems that only thing witch affects the bus is the pic clockspeed.. Tested 25MHz xtal,and the display works much better than 8 or 14 MHz,so that glcd component needs quite high clockspeed to work smooth.. Interesting to test that glcd component on 40MHz,the serial clock on bus is 10MHz,so its quite much on testboard "jumpwires":)...