Setting a graphical LCD's contrast

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Setting a graphical LCD's contrast

Post 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

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: Setting a graphical LCD's contrast

Post 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

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: Setting a graphical LCD's contrast

Post 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!)

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Re: Setting a graphical LCD's contrast

Post 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

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: Setting a graphical LCD's contrast

Post 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?

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Re: Setting a graphical LCD's contrast

Post 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

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: Setting a graphical LCD's contrast

Post 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

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Re: Setting a graphical LCD's contrast

Post 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

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Re: Setting a graphical LCD's contrast

Post by Zane »

Hi Ben,

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

Cheers

Zane

Post Reply