Page 1 of 1

Setting a graphical LCD's contrast

Posted: Mon Mar 21, 2011 9:03 am
by Zane
Hi,

I have setup a small test program using a knockoff Nokia 6100 display. When it is running i can see the images that are meant to be displayed however it appears the contrast may be a slight issue (the back light is working ok). What i was wondering was how can i adjust the contrast? Is there some value within the flowcode graphical lcd module that can be altered or does this value have to be manually manipulated using your spi module to send the data to the module?
Any help would be most appreciated.

Regards

Zane

Re: Setting a graphical LCD's contrast

Posted: Mon Mar 21, 2011 10:22 am
by Jan Lichtenbelt
Hi Zane,

The gLCD is an array of pixels which can be set in color individually in Flowcode. Flowcode added some simple combination of pixels like a line, a square etc. Changing contrast is changing (nearly all) pixels at the same time, following some mathematical formula. As far as I know, this is not standard in Flowcode.

Regards

Jan Lichtenbelt

Re: Setting a graphical LCD's contrast

Posted: Mon Mar 21, 2011 10:56 am
by Benj
Hello Zane,

If you are using the EB043 v1 equivalent display then you may be able to fix the problem by using code customization. Open the Init function for the gLCD component and find the line.

Code: Select all

gLCD_SendByte(MX_GFXLCD_CMD, 0x20);            //No inversion, 0x21 would be inverted display (different colors!)
Try changing it to..

Code: Select all

gLCD_SendByte(MX_GFXLCD_CMD, 0x21);            //No inversion, 0x20 would be non-inverted display (different colors!)

Re: Setting a graphical LCD's contrast

Posted: Mon Mar 21, 2011 9:23 pm
by Zane
Hi Ben,

I am new to the custom code part of these modules and have also have a poor understanding of c. However looking through the code i can see that the display appears to being using a philips controller from the commands sent.

With the line below this command would cause no inversion of the display as you have stated.

gLCD_SendByte(MX_GFXLCD_CMD, 0x20); //No inversion, 0x21 would be inverted display (different colors!)

Looking further down in the code i have seen more code that looks like it sends a command to the display followed by data shown below. The 0x25 in this case is the command for the screen contrast and the data afterwards is the contrast value in twos complement from 63 to -64.

CommandWithData(0x25, 0x10);

What i wanted to know is if i inserted this code so it looked like it does below would it work, is it in the right syntax?

gLCD_SendByte(MX_GFXLCD_CMD, 0x3A); //Interface Pixel Format....
gLCD_SendByte(MX_GFXLCD_PARAM, 0x02); //....data format: 8 bit for each Pixel
gLCD_SendByte(MX_GFXLCD_CMD, 0x20); //No inveMX_GFXLCD_RSion, 0x21 would be inverted display (different coloMX_GFXLCD_RS!)
gLCD_SendByte(MX_GFXLCD_CMD, 0x2D); //RGB-Table for the 256 out of 4096 color mode
CommandWithData(0x25, 0x10); //Set screen contrast

Unfortunately i am unable to try this out until the end of the week.

Thanks for your help

Regards

Zane

Re: Setting a graphical LCD's contrast

Posted: Tue Mar 22, 2011 11:03 am
by Benj
Hi Zane,

The command:

CommandWithData(0x25, 0x10);

Is for another type of LCD.

It looks like the LCD you are using accepts commands like this.

gLCD_SendByte(MX_GFXLCD_CMD, 0x3A); //Interface Pixel Format....
gLCD_SendByte(MX_GFXLCD_PARAM, 0x02); //....data format: 8 bit for each Pixel

Do you have a datasheet for your display or for the driver IC you can send a link to?

Re: Setting a graphical LCD's contrast

Posted: Tue Mar 22, 2011 11:41 am
by Zane
Hi Ben,

Here is the link to the phillips datasheet for the controller.

http://www.nxp.com/acrobat_download2/da ... 8833_1.pdf

Thanks for your help,

Regards

Zane

Re: Setting a graphical LCD's contrast

Posted: Tue Mar 22, 2011 5:02 pm
by Benj
Hello Zane,

Right this command would alter the contrast.

gLCD_SendByte(MX_GFXLCD_CMD, 0x25); //Contrast Command....
gLCD_SendByte(MX_GFXLCD_PARAM, 0x00); //Set contrast to 0x00 - replace 0x00 with your contrast setting

Re: Setting a graphical LCD's contrast

Posted: Wed Mar 23, 2011 7:45 am
by Zane
Hi Ben,

Thanks for this info i will try it out later on in the week. Your help is most appreciated. Will let you know how it goes.

Cheers

Zane

Re: Setting a graphical LCD's contrast

Posted: Mon Mar 28, 2011 8:42 am
by Zane
Hi Ben,

All of this worked a treat, thankyou for your help.

Cheers

Zane