Hi Ben and other guys
Got a major problem. Using FC4 and just about finished my program/project....with
a hiccup at 12th hour. The project calls for sending a string out the serial port
that is generated from float calculations. I did see a post somewhere that the
float to string is internally limited by integer data type. I need to have a float
to string routine that can handle maybe up to 7 or 8 digits in the whole part
of the number.
Problem is i cannot goto FC5 just yet, as this project is already stressed
timewise and i do not have enough time to sort out new licences/code
porting etc etc....
Guys, i am really in a pickle here. This is the last project i am doing using FC4
so i really need a solution urgently.
After this i am will be going to FC5 which i believe supports long type var
for the whole variable.
Help!
Thanx
Mark
Float to string problem
Moderator: Benj
- 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: Float to string problem
Hello Mark,
Please make a backup of the internals.h file located in the "Flowcode v4/FCD" folder and then replace the file with the file located here.
This should allow up to 7 digits on the whole number though I have not tried a compile.
Let me know how you get on.
Please make a backup of the internals.h file located in the "Flowcode v4/FCD" folder and then replace the file with the file located here.
This should allow up to 7 digits on the whole number though I have not tried a compile.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: Float to string problem
Hi Ben
I had an idea the internals needed some surgery
anyway, i did try with new internals file but it gives compile error....
Float_test3.c
Starting preprocessor: c:\PROGRA~1\MATRIX~1\FLOWCO~2\boostc\pp.exe Float_test3.c -i c:\PROGRA~1\MATRIX~1\FLOWCO~2\boostc\include -d _PIC18F2610 -la -c2 -o Float_test3.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX
.............
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:15): error: unknown identifier 'FCI_LONG_TOSTRING'
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:15): error: failed to generate expression
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:15): error: invalid operand 'FCI_LONG_TOSTRING(whole, temp_string, 7)'
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:13): error: failed to generate expression
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1485:18): warning: local variable 'str_length' may be used uninitialized
Float_test3.c success
failure
Return code = 1
Flowcode was unable to compile the flowchart's C code due to the following errors:
If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.
FINISHED
Can you give it another go? I have a test file if you want to use that to compile with. It is a very simple program.
Cheers
Mark
I had an idea the internals needed some surgery
anyway, i did try with new internals file but it gives compile error....
Float_test3.c
Starting preprocessor: c:\PROGRA~1\MATRIX~1\FLOWCO~2\boostc\pp.exe Float_test3.c -i c:\PROGRA~1\MATRIX~1\FLOWCO~2\boostc\include -d _PIC18F2610 -la -c2 -o Float_test3.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX
.............
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:15): error: unknown identifier 'FCI_LONG_TOSTRING'
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:15): error: failed to generate expression
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:15): error: invalid operand 'FCI_LONG_TOSTRING(whole, temp_string, 7)'
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1483:13): error: failed to generate expression
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h(1485:18): warning: local variable 'str_length' may be used uninitialized
Float_test3.c success
failure
Return code = 1
Flowcode was unable to compile the flowchart's C code due to the following errors:
If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.
FINISHED
Can you give it another go? I have a test file if you want to use that to compile with. It is a very simple program.
Cheers
Mark
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: Float to string problem
Hi Ben
Simple float to str test program
Mark
Simple float to str test program
Mark
- Attachments
-
- Float_test3.fcf
- (7 KiB) Downloaded 296 times
- 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: Float to string problem
Hi Mark,
This new one seems to compile correctly now.
This new one seems to compile correctly now.
- Attachments
-
- internals.h
- (73.3 KiB) Downloaded 295 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: Float to string problem
Hi Ben
Big improvement! I can now get up to 6 whole digits....
however, i still need 7 to 8 digits....if i goto 1 million on
the whole, it puts in odd char in digit 6...the zero following the 1
as in 1 millon
I am actually testing on 18F2620 with 232 chip to hyperterm.
Everything works great but see example output on hyperterm
START TEST (1 x 999999)
999999.000000
OK
START TEST (1 x 1000000)
1:00000.000000
Not OK
Big improvement! I can now get up to 6 whole digits....
however, i still need 7 to 8 digits....if i goto 1 million on
the whole, it puts in odd char in digit 6...the zero following the 1
as in 1 millon
I am actually testing on 18F2620 with 232 chip to hyperterm.
Everything works great but see example output on hyperterm
START TEST (1 x 999999)
999999.000000
OK
START TEST (1 x 1000000)
1:00000.000000
Not OK
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: Float to string problem
Hi Ben
Any further progress on the fix for the corrupt 6th digit when doing
7 digit string?
If we can sort that out it will be champion
Thanx
Mark
Any further progress on the fix for the corrupt 6th digit when doing
7 digit string?
If we can sort that out it will be champion
Thanx
Mark
- 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: Float to string problem
Hello Mark,
Sorry for the delay.
Here is a file that should hopefully work a bit better.
If there is still an issue then look at line 1505 and edit it to this.
Sorry for the delay.
Here is a file that should hopefully work a bit better.
If there is still an issue then look at line 1505 and edit it to this.
Code: Select all
str_length = FCI_LONG_TOSTRING(whole, temp_string, 8); //Convert integer numbers to strings
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: Float to string problem
Hi Ben,
That did the trick thanx
My apologies for asking for rapid answer, had unusually tight deadline.
This project is now complete, and will be moving onto FC V5...yay!
Consider that another sale in the bag for MM
For all those observing this thread, you may use this latest attached
internals.h file to achieve larger float to string in FC4 due to
Benj's great support.
Thank you very much!
Mark
That did the trick thanx
My apologies for asking for rapid answer, had unusually tight deadline.
This project is now complete, and will be moving onto FC V5...yay!
Consider that another sale in the bag for MM
For all those observing this thread, you may use this latest attached
internals.h file to achieve larger float to string in FC4 due to
Benj's great support.
Thank you very much!
Mark