Dear all,
I use Freemaster 3.1 to control a S12ZVL devkit, I created a control page (html, css, js) for this.
In my js script I use functions that are defined in the freemaster-client.js library.
One of them is pcm.WriteFloatVariable = function(addr, data)
When used, the "." is ignored, if I ask for 10.2 to be written, my float var will contain 102.
My code is the following :
Solved! Go to Solution.
Dear Matisse,
it seems as a bug related to inappropriate use of system locale settings and string conversion. I think your Windows system is set to use "comma" as a floating point, and use point as a "thousand separator". Is this correct?
Can you please make few experiments?
Thanks,
Michal
Dear Matisse,
it seems as a bug related to inappropriate use of system locale settings and string conversion. I think your Windows system is set to use "comma" as a floating point, and use point as a "thousand separator". Is this correct?
Can you please make few experiments?
Thanks,
Michal
Dear MichalH,
It was indeed a bug related to Region and Language, setting the format to English, or use a coma in the function ( with Dutch format), solves the issue.
Thank you very much for your answer !
Dear Matisse,
thank you for confirmation. It is actually a bug in FreeMASTER as it should not depend on system settings and should treat the numbers always in a JavaScript-compatible way (with a dot).
As you already tested, the workaround is to set a locale to English. We will fix this issue in the next version.
Thanks,
Michal
One more point FYI: You should be using just WriteVariable call when you have your FreeMASTER variable defined. You variable is set to float type, so the FreeMASTER will know how to handle it.
The WriteFloatVariable should be used when writing to memory directly. This call uses a C symbol name or a direct address as an argument (while WriteVariable uses the FreeMASTER variable name instead).
Regards,
Michal