Page 1 of 1
ARM V5 error compiling floor function
Posted: Tue Jul 03, 2012 9:55 pm
by Mantas
Hello support,
just got my hands on new version, and imported a project from v4 ARM. When I am trying to simulate or compile I get an error saying "unknown or missing function: floor". Crearly the function is there in the list and it is writen (used) correctly, it was working in v4. Maybe you can investigate this error.
Best regards,
Mantas
Re: ARM V5 error compiling floor function
Posted: Tue Jul 03, 2012 10:06 pm
by DavidA
Hello Mantas,
Can you post a fcf file which exhibits this behaviour for us?
Re: ARM V5 error compiling floor function
Posted: Wed Jul 04, 2012 10:07 am
by JonnyW
Hello. Don't worry about posting the fcf - I know the problem. I'm afraid the function has been lost in the v5 build, along with ceil() and round() - I have added support for it now and it will be rolled in the next release.
There are the following possible workarounds:
- Instead of calling floor(f), assign your float to an int and back to a float: i = f
- Instead of calling floor(f), do the calculation f = f - fmod (f,1)
- Create a macro called 'floor' and add the above code to this
I would lean to option 3 here, so have created a flowchart macro for you that you can import (Menu->Macro->Import...). This will mean your programs work correctly. Note this will override the built-in version of the function when called. I have tested this on the PIC and it works OK - it should also work on the ARM no problems.
Cheers,
Jonny
Re: ARM V5 error compiling floor function
Posted: Wed Jul 04, 2012 6:09 pm
by Mantas
Unfortunately when I imported the macro, i get windows error, "program stopped working correctly, bla bla bla"...i will try to use the other workarounds for now, but I am waiting for a fix update.
Best regards,
Mantas
Re: ARM V5 error compiling floor function
Posted: Thu Jul 05, 2012 10:16 am
by JonnyW
Hi. Are you definitely using the Menu->Macro->Import... option? It seems to work OK testing here so I can't explain this.
Anyway, all the macro is is a macro called 'floor' that has a floating point argument called 'value' and a return type of float. The only code is the following text in a calculation icon:
Code: Select all
.Return = .value - fmod (.value,1)
If you would like to add this manually it should work fine.
Jonny
Re: ARM V5 error compiling floor function
Posted: Thu Jul 05, 2012 7:55 pm
by Mantas
Yes I used macro import function. I tried creating new project and do the calculations in the calc box, and it worked fine, just that v4 project is still not working, and the flowcode crashes...very strange
Regards,
Mantas
Re: ARM V5 error compiling floor function
Posted: Fri Jul 06, 2012 6:43 pm
by JonnyW
Hi. If you post your flowcode file (or PM me with it) I can take a look and maybe find out why it crashes - I'm puzzled why this would crash.
Barring that, adding that macro manually into any Flowcode v5 program should behave as expected.
Jonny