C-code

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

Moderators: Benj, Mods

Post Reply
Henk
Posts: 40
Joined: Sun May 20, 2007 11:03 am
Location: Nederland
Contact:

C-code

Post by Henk »

Good morning Gentlemen,

When I Flow Code leddisplay's use and I want to see a 9 I would also like the dash (segmentD) want to see at the bottom of the tail.
Is that possible?

Groeten Henk.

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: C-code

Post by Benj »

Hello

Yes this is possible. Open your Flowcode components directory located in
C:\Program Files\Matrix Multimedia\Flowcode V3\Components and open the LED7SEG1_Code.c or the LED7SEG4_Code.c file into notepad depending on which component you wish to alter.

Browse to this line in the C code file.

//set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, %l};

and change to this
//set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, 0x98};

The %values are values passed from Flowcode to represent the numbers 0 - 9

The 0x98 is the current value for the 9. You could try the following values to get your 9 with bottom line.
0x90 or 0x88 one of these should be correct.

Save the file and restart Flowcode. You will not see the change in the simulation but when running on the hardware the output will use your new set of values.

Henk
Posts: 40
Joined: Sun May 20, 2007 11:03 am
Location: Nederland
Contact:

Re: C-code

Post by Henk »

Hello Ben,

I tried but I see no change in the 9 when I send my program to my USB steering board. I have tried 0x90 0x88 and 0x98.

I have do all de things what you said but Nothing works.

Greetings
Henk

Benj wrote:Hell0

Yes this is possible. Open your Flowcode components directory located in
C:\Program Files\Matrix Multimedia\Flowcode V3\Components and open the LED7SEG1_Code.c or the LED7SEG4_Code.c file into notepad depending on which component you wish to alter.

Browse to this line in the C code file.

//set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, %l};

and change to this
//set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, 0x98};

The %values are values passed from Flowcode to represent the numbers 0 - 9

The 0x98 is the current value for the 9. You could try the following values to get your 9 with bottom line.
0x90 or 0x88 one of these should be correct.

Save the file and restart Flowcode. You will not see the change in the simulation but when running on the hardware the output will use your new set of values.

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: C-code

Post by Benj »

Hello Henk

Just to confirm you are changing the code inside the LED7SEGX_Code.c file and not your Flowcode project C file.

Henk
Posts: 40
Joined: Sun May 20, 2007 11:03 am
Location: Nederland
Contact:

Re: C-code

Post by Henk »

Hello Ben,

I've done everything you said.
I went to c: \ Program Files \ Matrix Multimedia \ Flow Code V3 \ components went and got the file opened in notepad led7seg4_code changes Done as you have said.
I have tried //set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, %l, 0x98};
and
//set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, %l, 0x90};
and
//set pattern array for the display
rom char* cSegmentArray = {%c, %d, %e, %f, %g, %h, %i, %j, %k, %l, 0x88};

I really do exactly as it should.
And I don''t look on the computer, but I look on my USB tesboard
But I see no indent on the bottom of the nine.
Do you have advice?



Benj wrote:Hello Henk


Just to confirm you are changing the code inside the LED7SEGX_Code.c file and not your Flowcode project C file.

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: C-code

Post by Steve »

Have you also tried modifying the led7seg1.c file?

If that doesn't work, then I suspect that the code produced by the 7seg component is hard-coded within the component itself and you cannot modify it. Flowcodev4 will definitely have external code for the 7seg components, so you will need to wait for this to be able to customise it.

Henk
Posts: 40
Joined: Sun May 20, 2007 11:03 am
Location: Nederland
Contact:

Re: C-code

Post by Henk »

Hi Steve,

Yes it is true that I have also tried to led7seg1.c file, but here I see no change on my USB test board.
now I must wait til next upgrade from Flowcode
Thank you Steve!

Then I have another question,
I have a temperature sensor built with Flowcode. De temperature go from -30 to +50.
How can I show only the segment G on display 4 as the temperature drops below zero?

Henk.




[quote="steve"]Have you also tried modifying the led7seg1.c file?

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: C-code

Post by Benj »

Hello Henk

You could manually set and clear the port pins yourself, the alternative seems to be wait for V4.

Remember the 7 segments are common anode so the 8 pins that control the segments are active low eg a output 0 causes the corresponding LED to function.

Henk
Posts: 40
Joined: Sun May 20, 2007 11:03 am
Location: Nederland
Contact:

Re: C-code

Post by Henk »

Thanks you for your time I wait voor Flowcode V4

Henk.

Henk
Posts: 40
Joined: Sun May 20, 2007 11:03 am
Location: Nederland
Contact:

Re: C-code

Post by Henk »

Hello,

Last week I had a question which I asked whether it was possible for the bar at the bottom of the 9 to be seen.
And whether it was possible that I could see a minus sign as the temperature of my temperature display is below 0.
That was not so easy to solve as I thought.
But we have still found a way to solve it.
I have programmed three more rules in the folder Flowcode/components/led7seg4 C.code.

/ / get pattern for digit
Char cSegmentValue = cSegmentArray [value% 10];
If (DecimalPoint) cSegmentValue & =% m;
And below are the 3 lines that I have programmed.
if (value == 9) cSegmentValue = 0x90, / / 9 with indent
if (value == 11) cSegmentValue = 0xff, / / display off
if (value == 12) cSegmentValue = 0xBF, / / '-' 1011 1111

And now I can see a dash at the 9 and a minus sign.

Greetings Henk.

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: C-code

Post by Benj »

Hello Henk

Great work glad its all working correctly for you now. We are making the editability of components easier in V4 but congrats for getting the additional code working with V3.

Post Reply