gLCD or Graphics tutorial

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

Moderators: Benj, Mods

Post Reply
myval
Flowcode V4 User
Posts: 40
Joined: Sun Feb 22, 2009 6:54 am
Location: Sydney
Has thanked: 2 times
Contact:

gLCD or Graphics tutorial

Post by myval »

Hi,
I am just wondering if there is any good tutorial on how to design and use graphics. Like when you draw something on gLCD, what is the best/ fastest way how to add and remove something on of the screen, do you refresh whole screen everytime you change something.
I know I might sound bit confused, because I am! I have never used graphics at this level when you write something for PC that basic layer is alrady done so you do not even think about it.
I do not know if I made it clear or not but simple example imagine you want brgraph (or progressbar), when you go up and down do you redraw whole LCD or just one bar at the time or what would be the way to go.
tutorial like that would help. Something in simple language so even someone like me would understand, not big mathemati formulas just how to do it. If I look at my phone it does really fancy stufm I do not want to go this far but good looking menus and progressbars and little analogue like meters....


thanks
Josef

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: gLCD or Graphics tutorial

Post by Benj »

Hello Josef

The best practise would be to redraw the entire screen to avoid any corruption. However in an embedded context where you know exactly what the screen is going to be doing you can do things very differently. For example with your loading bar you could simply draw a rectangle for the load bar border and then draw either vertical lines or mini vertical rectangles for the load increments. The less you draw the faster your application will be so remember to keep this in mind especially if you are using a PIC.

With the mini rectangles you could make this interrupt based. The program is loading but you dont know how quickly. While you are doing the steps to perform the loading you increment a variable. Then have a timer interrupt routine to take the incremented variable and draw a rectangle the height of the loading bar from the start / end of the last draw position to the new loaded value. This allows for a better looking load bar that actually informs you of how the device is doing in real time.

A few ideas here anyway. Hope this helps.

myval
Flowcode V4 User
Posts: 40
Joined: Sun Feb 22, 2009 6:54 am
Location: Sydney
Has thanked: 2 times
Contact:

Re: gLCD or Graphics tutorial

Post by myval »

Thanks for the reply, any info helps. Well how would you go eg. about listing through the menu it inverts everything or make it bigger or something fancy like that in the sellected line :?: :shock: :cry: I think I might be complicating things more than they are or my own cpu gets overloaded. I just can not work these graphic things out at all???!!!
And if you use interrupts to draw something as you said then things might get even funnier, if you have part of the screen dynamicaly generated than you might really screw the picture up.?
I think I just have to keep experimenting and it sound like there is no right or wrong, one way might be slower but better and the other way faster but cut short???
hmmm I was not born for graphics I think! :cry:

Thank you

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: gLCD or Graphics tutorial

Post by Benj »

Hello

Yes sorry I was complicating things before saying about interrupts. What I meant was in an embedded context you are in 100% control of the code which means that you can do some very dodgy things that you wouldnt be able to get away with on something like windows etc. As for making stylish menu systems it may be best to draw everything as you go around so you can simply change font sizes and or colours on the fly etc. Again if the PICs seem slow then maybe a AVR or ARM would be a possibility. The AVRs seem to fly with the displays as they are running almost 4x faster then a PIC running at the same clock speed and the ARMs are faster still. Sean made a game using the colour display and although it runs on the PICs its actually playable on the AVR and ARM devices.

The KS0708 blank and white graphical LCDs have an invert mode where you can define a rectangle and invert the colour. The colour displays do not have this feature but it would be possible to do by adding a function to the driver C code.

myval
Flowcode V4 User
Posts: 40
Joined: Sun Feb 22, 2009 6:54 am
Location: Sydney
Has thanked: 2 times
Contact:

Re: gLCD or Graphics tutorial

Post by myval »

Thank you,
I have used ARM with free rtos and that is a killer it flys!!! but for this application I just wanted to use pic (cheap and easy) with 20x4 lcd but I have discovered that use of color gLCD would be really nice I got sidetracked this way. I have to think about that inversion, I just can not get my head around it.
I can not wait for you guys to ship my stuff so I can start experimenting, simulator is fine but does not simulate LUT and C :cry:
thank you
I will shoot some questions as soon as I get into it.

Thanks
Josef

User avatar
greentech
Flowcode V4 User
Posts: 158
Joined: Mon Jan 31, 2011 2:11 pm
Has thanked: 10 times
Been thanked: 2 times
Contact:

Re: gLCD or Graphics tutorial

Post by greentech »

hit here,

i wish to control a big lcd "240x128" LM3229 with pic micro. iS IT POSSIBLE?

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: gLCD or Graphics tutorial

Post by Benj »

Hello,

Yes it is possible, Should be fairly similar to the displays used in the beta gLCD components available from here.
http://www.matrixmultimedia.com/Flowcode_Components.php

Post Reply