Dear Support,
Maybe I'm doing something wrong but this program works in the simulator, but the compiler is unable to translate this. I use 24FJ256GA110 chip.
Could you help me?
Best Regards:
Lagoda
Floating point numbers
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: Floating point numbers
Hello Lagoda,
Thanks for letting us know of the problem. I have found the cause and hopefully fixed it.
Simply copy the file below into your "Flowcode 7/CAL/PIC16BIT" folder and then compilation should work correctly.
Let me know how you get on.
Thanks for letting us know of the problem. I have found the cause and hopefully fixed it.
Simply copy the file below into your "Flowcode 7/CAL/PIC16BIT" folder and then compilation should work correctly.
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
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Floating point numbers
Hi Ben,
Thanks for the quick help.
Now, the compiler is able to translate but in the simulator only works correctly if I set y=1 in the "fround (x, y)" function.
In the target circuits after the decimal point on the display appears only "0", independently value of "y".
Best Regards,
Lagoda
Thanks for the quick help.
Now, the compiler is able to translate but in the simulator only works correctly if I set y=1 in the "fround (x, y)" function.
In the target circuits after the decimal point on the display appears only "0", independently value of "y".
Best Regards,
Lagoda
- 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: Floating point numbers
Hi Lagoda,
Make sure your not entering any floating point numbers as decimal.
e.g. 1 should be entered as 1.0
Otherwise the compiler will think it's a whole number and use the integer routines to do the maths rather than the floating point routines.
Make sure your not entering any floating point numbers as decimal.
e.g. 1 should be entered as 1.0
Otherwise the compiler will think it's a whole number and use the integer routines to do the maths rather than the floating point routines.
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
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Floating point numbers
Hi Ben,
Thanks, I'll check again, but if the floating point variable is converted to a string then I see on the display what the value should be rounded.
When I use the "fround" function before converted to string, that happens what I wrote.
I made an example that maybe help.
The function in my project has been solved differently, but I would like to know what is causing the trouble.
I've run out of ideas.
Lagoda
Thanks, I'll check again, but if the floating point variable is converted to a string then I see on the display what the value should be rounded.
When I use the "fround" function before converted to string, that happens what I wrote.
I made an example that maybe help.
The function in my project has been solved differently, but I would like to know what is causing the trouble.
I've run out of ideas.
Lagoda
- Attachments
-
- float_to_string_test2.fcfx
- (9.31 KiB) Downloaded 323 times
-
- Compiler_messages.jpg
- (223.62 KiB) Downloaded 87 times
-
- Test_result_on_the_display.jpg
- (207.65 KiB) Downloaded 87 times
-
- Flowcode v5 User
- Posts: 273
- Joined: Thu Apr 17, 2008 9:59 am
- Has thanked: 19 times
- Been thanked: 16 times
- Contact:
Re: Floating point numbers
Good day Ben,Benj wrote:Hello Lagoda,
Thanks for letting us know of the problem. I have found the cause and hopefully fixed it.
Simply copy the file below into your "Flowcode 7/CAL/PIC16BIT" folder and then compilation should work correctly.
Let me know how you get on.
Having had the same problem as Lagoda, I downloaded this same file. I am using an 8-bitter, but from the header of this c-file it appears to be the same for 8- as 16-bit processors. So I replaced the distribution PIC_CAL_Float.c with the renamed PIC16BIT_CAL_Float.c and it worked in the sense that the compiler errors are now gone.
However, I have not been able yet to test if it really works on the hardware. So my question is, will it, or is there another floating point c-file I need to replace the 8-bit library file with.
Jan