Control of components from inside flowcode?

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

Moderators: Benj, Mods

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Control of components from inside flowcode?

Postby cobra1 » Sun Jun 24, 2012 8:54 pm

In the GLCD component file i have added in 2 lines of code to allow for contrast adjustment.

Code: Select all

gLCD_SendByte(MX_GFXLCD_CMD, 0x25);          //Contrast Command
gLCD_SendByte(MX_GFXLCD_PARAM, 0x51);         //Contrast Level


I am trying to access these commands from inside flowcode so as to adjust the contrast from inside my running software.
I am not getting very far at the moment, i tried the following in a C box inside flowcode.

Code: Select all

FCD_gLCD0_gLCD_SendByte(MX_GFXLCD_CMD, 0x25);          //Contrast Command
FCD_gLCD0_gLCD_SendByte(MX_GFXLCD_PARAM, 0x51);         //Contrast Level


This code compiles ok, but makes no changes when changing the parameter value from 0x51 to something different.
Is there something i am missing to connect the component file and the flowcode software together?

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

Re: Control of components from inside flowcode?

Postby Benj » Mon Jun 25, 2012 4:26 pm

Hello Cobra,

You sometimes have to do things like this with the display off or the setting does not actually update.

Maybe try using custom code on the gLCD component and editing the contrast value passed as part of the init function.

Which display are you using?

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: Control of components from inside flowcode?

Postby cobra1 » Sat Jul 07, 2012 6:35 pm

Hi Ben,

I am able to change the contrast when editing the init function, but that means i have to change the init function, then update the software to the chip for the settings to take effect.
What i would like to do is change the init function from a menu in the software.

Is this possible?

Oh the LCD is the Nokia 6610 LCD

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

Re: Control of components from inside flowcode?

Postby Benj » Mon Jul 09, 2012 9:36 am

Hi Cobra,

Can you use a Flowcode variable to hold the contrast setting eg contrast. Then customise the gLCD component init function to pass the value from FCV_CONTRAST into the contrast register. Once you have done this you simply have to put a value into the variable and then call the init function.