View previous topic :: View next topic |
Author |
Message |
Thomasn102 Guest
|
Off-Topic: How to reduce flicker on the graphic LCD? |
Posted: Sat Mar 06, 2004 2:23 pm |
|
|
Hi everyone,
How do I reduce the flicker on my graphic LCD? This is basically how I control the LCD:
while (1) {
clear_LCD(); // Write 0 to the entire LCD RAM
write_stuff();
}
The reason why I have to clear the entire LCD was if I don't, the stuff from the previous screen is still there (if it is not overwritten) and I think this is the source of my problem, but I don't know how to get by this. Please help!
Best regards,
Thomas |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Sat Mar 06, 2004 6:57 pm |
|
|
I've never worked with graphic LCDs, but there a couple of things you can do which may help a bit. First, can you reduce the frequency of clearing the display (you've probably done this already). Second, can you create some sort of record of the used addresses of your LCD RAM, so in the Clear() function you can write a 0 only to those addressed instead of the whole LCD RAM? |
|
|
Thomasn102 Guest
|
|
Posted: Sun Mar 07, 2004 12:01 pm |
|
|
It is a little more complicated. Let's say I have
these codes:
data = 12345;
printf("%d",data); // LCD scr displays "12345"
data = 9;
printf("%d",data); // LCD scr displays: "92345"
for the second printf, instead of displaying "9", it
diplays "92345". It is hard to calculate how many
digit the "data" field has to provide the blank
space.This is the reason why I have to clear the
entire LCD to get rid of this kind of problems. I
thought of keeping an image of the LCD on RAM, but
this requires lots of RAM space.
Regards,
Thomas |
|
|
Pete Smith
Joined: 17 Sep 2003 Posts: 55 Location: Chester, UK
|
|
Posted: Sun Mar 07, 2004 12:53 pm |
|
|
Thomasn102 wrote: | It is a little more complicated. Let's say I have
these codes:
data = 12345;
printf("%d",data); // LCD scr displays "12345"
data = 9;
printf("%d",data); // LCD scr displays: "92345"
for the second printf, instead of displaying "9", it
diplays "92345". It is hard to calculate how many
digit the "data" field has to provide the blank
space.This is the reason why I have to clear the
entire LCD to get rid of this kind of problems. I
thought of keeping an image of the LCD on RAM, but
this requires lots of RAM space.
Regards,
Thomas |
You could do a kludge whereby you know that your data field will only ever be 6 digits. You could append 5 spaces to the end of your output string, and force an EOF (0x00) in at the 7th character.
Pete. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Sun Mar 07, 2004 2:13 pm |
|
|
You will have to run some tests to see if the CCS compiler's printf function supports all the modifiers but you can tell printf how many digits to allocate and if it should left or right justify the text.
I have used "%4X" to force the display of a hex value to be 4 characters.
In your case you could do "%6lu" to force leading spaces (assuming unsigned long ints, change to suit your needs). But off the top of my head I can't recall if I have forced left-justification with the CCS compiler.
A good C reference should cover it, I think the K&R book does in one of the appendicies. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Sun Mar 07, 2004 2:15 pm |
|
|
Another thought, it is possible with the text based LCDs to read-back data. Can you do that with your graphics LCD? Then you could read each screen position prior to update and if it is different then update that location otherwise skip. Or if it is more efficient to read several sequential locations then allocate enough RAM for that and update by row (or column).
Down side is lots of extra machine cycles. Up side is minimal flicker and not a lot of extra RAM required. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
hillcraft
Joined: 22 Sep 2003 Posts: 101 Location: Cape Town (South africa)
|
Any LCD or static display (non-multiplexed) |
Posted: Mon Mar 08, 2004 10:09 am |
|
|
Consider this:
You should not update the display if nothing has changed. Therefore you should keep a record of what has just been placed onto the display. If the new data is the same as the old data, then you bypass the write to the LCD, and if the data has changed, then you know exactly what action needs to be taken to clear the existing data from the display before you apply the new data to the display.
Imagine if you have pictures and a large number of different bits of unrelated information on the display, there is no way that you can manage the display if you clear the entire display before each write. |
|
|
Konrad
Joined: 15 Sep 2003 Posts: 34
|
Reducing Flicker |
Posted: Fri Mar 12, 2004 2:43 pm |
|
|
Note that the Graphic display driver GLCD provided by CCS for the KS0108 draws everything pixel by pixel. It is possible to write bytes to this chip at a time, i.e. 8 times faster. This does reduce flicker! |
|
|
|