Glcd (ks0108) printing new line and earesing old line.

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

Moderator: Benj

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Glcd (ks0108) printing new line and earesing old line.

Postby Jordy101091 » Sat Aug 23, 2014 10:56 pm

Hi all,

I have a question and I can't seem to figure out how to approach this problem.
I'm working on a analog clock type display. I have figured out how to print the clock handles and such.
They are moving as well but I don't know how to delete the previous printed pixels.
Without clearing the whole screen.

I have tried to change the foreground color in flowcode to print the same line in white pixels.
But doesn't seem to work in simulation.
Or doesn't this option show up in simulation mode.

Let me know what you all think.

Regards jordy
the will to learn, should not be stopped by any price

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 114 times
Been thanked: 112 times
Contact:

Re: Glcd (ks0108) printing new line and earesing old line.

Postby STibor » Sun Aug 24, 2014 6:43 am

Hi!

Draw a sketch of the previous background color.
Attachments
draw_clear.fcfx
(8.67 KiB) Downloaded 76 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: Glcd (ks0108) printing new line and earesing old line.

Postby dazz » Sun Aug 24, 2014 1:07 pm

Hi Jordy
I've read a post from Benj on the forum (cant find it now), where from memory he says to simply blank out the pixels you just wrote, then send the next set of pixels,i assume your clock gave will be fixed so try resending the last hand update using the background colour, then send the next hand pos etc

print hand in foreground colour
delay
resend last print hand in background colour etc

hope it helps

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
Benj
Matrix Staff
Posts: 14373
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4447 times
Been thanked: 4150 times
Contact:

Re: Glcd (ks0108) printing new line and earesing old line.

Postby Benj » Wed Sep 24, 2014 3:44 pm

Hello,

For an analogue clock something like this should work well.

Loop Start

Clear Hour Hand - Draw previous hour position in BG colour
Clear Minute Hand - Draw previous min position in BG colour

Draw current Minute hand - Draw current min position in FG colour
Draw current Hour hand - Draw current hour position in FG colour

update prev values with current values

Small delay, maybe calculate all your current angles here to speed up draw times.

Loop End

If you use a timer interrupt in the background to measure the passing of time and update your sec, min and hour variables then it should all work nicely.