Graphical LCD and four PWM help needed

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

Post Reply
WalkOver
Posts: 65
Joined: Fri Nov 23, 2007 11:24 pm
Contact:

Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

Post 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.
Attachments
GraphicLCD.zip
(72.63 KiB) Downloaded 734 times

WalkOver
Posts: 65
Joined: Fri Nov 23, 2007 11:24 pm
Contact:

Re: Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

Post by Benj »

Hello

The Nokia Graphics display refers to this product.

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

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

Re: Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

Post 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;
    }

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

Re: Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

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

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: Graphical LCD and four PWM help needed

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

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

Re: Graphical LCD and four PWM help needed

Post 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":)...

Post Reply