Page 1 of 1

C-code

Posted: Tue Jan 27, 2009 9:01 am
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.

Re: C-code

Posted: Tue Jan 27, 2009 4:14 pm
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.

Re: C-code

Posted: Wed Jan 28, 2009 9:07 pm
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.

Re: C-code

Posted: Thu Jan 29, 2009 1:03 pm
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.

Re: C-code

Posted: Thu Jan 29, 2009 8:40 pm
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.

Re: C-code

Posted: Fri Jan 30, 2009 9:06 am
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.

Re: C-code

Posted: Fri Jan 30, 2009 4:01 pm
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?

Re: C-code

Posted: Fri Jan 30, 2009 4:46 pm
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.

Re: C-code

Posted: Fri Jan 30, 2009 5:13 pm
by Henk
Thanks you for your time I wait voor Flowcode V4

Henk.

Re: C-code

Posted: Wed Feb 04, 2009 6:27 pm
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.

Re: C-code

Posted: Thu Feb 05, 2009 10:48 am
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.