Clearing a LCD-area as soon as possible

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Clearing a LCD-area as soon as possible

Post by CS » Tue Sep 02, 2008 2:22 pm

Hi all,

I have build a schematic for a VU-Meter with a PIC and a LCD. It works great but it is a little bit slow. May be someone is able to help me.

Here is the code to build the bargraph:

Code: Select all


......
Dim ADVUL as byte
Dim ADVUR as byte

....

Sub ADInAsVURect(value,sline,eline As Byte)
 Dim x As Integer

 For x = 1 To value
     Rectangle (3*x+14,sline,3*x+15,eline)    
 Next

End Sub


Repeat

ADVUL = (ADC.Read(2)+1)/32 
ADVUR = (ADC.Read(3)+1)/32

ADInAsVURect(ADVUL,17,20)
ADInAsVURect(ADVUL,24,27)

Until False
The code reads the values from the ADC channel 2 and 3 and divide it with 32. The maximal bars are 32 (1024/32 = 32).
Until here it works great! But before I have to show new bars, I have to clear the area, and here is my problem. When I use for example Pen.Color = 0 and a For - Next to clear the area then the VU-Meter is very slow and doesn't look nice.

Can anybody give me a hint, how to clear the area as soon as possible?

Thanks in advance

Christian

johngb
Registered User
Registered User
Posts: 139
Joined: Tue Oct 03, 2006 10:16 pm

Post by johngb » Tue Sep 02, 2008 2:56 pm

Why not clear or draw just the difference between last sample and this sample. If its going up you only have to draw the increase, if its going down you only have to clear the decrease.
JohnB

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Tue Sep 02, 2008 5:12 pm

Can you up the speed of the micro, does it have a pll?
If you use the pll it will refresh 4 times as quickly.

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Tue Sep 02, 2008 5:25 pm

Which GLCD are you using?

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Sep 02, 2008 6:12 pm

Hi all,

@ johngb: Yes, thats what I'm thinking of, but I don't have the right idea.

@ Doj: I use the PIC 18F4620. This MCU have a PLL. At this time I use him with 20MHz. When I use the PLL I can have 40MHz.

@ Steven: I use my favorite display type EA-DIP with the SED 1520 Controller.

Christian

Jon Chandler
Registered User
Registered User
Posts: 185
Joined: Mon Mar 10, 2008 8:20 am
Location: Seattle, WA USA
Contact:

Post by Jon Chandler » Fri Sep 05, 2008 1:38 pm

An easy way to clear the screen or invert the screen is to create a screen-size graphic and use the setimage command. If the screen has static information (like a title and boxes for example), creating a graphic with everything on it may be faster than redrawing the screen each time it's cleared.

Jon

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Sep 09, 2008 3:21 pm

Hallo all again,

I'm back with no success.

@ Jon Candler: The command 'setimage' was so slow, that it wasn't useful.

Now I'm trying to convert johngb's tip!?

Christian

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Sat Oct 11, 2008 9:43 am

Hi all,

thanks for the hints. Now I have solved the problem.

The best solution is the hint from johngb! Thanks again for that!

Reguards

Christian

Post Reply