The function toPLCfloat does no byte swapping even if DAVE_LITTLE_ENDIAN is defined.
This is caused by the following line in this function:
f.a=ff;
After removing this line, the function works well.
The code have no meaning without the line f.a=ff;.
Bit i have a problem with this function in .NET.
When you convert a single with toPLCfloat an the Result is in LittleEndian not a number the .NET framwork change the value.
For example you convert the value 0.69915 with toPLCfloat() the result is QNAN.
When you write this value to the PLC you have the value 0.0027 because the .NET default value for QNAN is 0.0027.
I think i change the toPLCfloat function in .NET that they returns a ByteArray.
Greets Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem in the function toPLCfloat exists. There are 2 lines with f.a=ff; (line 1921 and 1929) if we remove line 1929 the function will work correct
to genesis_81 I think you have to use function daveToPLCfloat
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The code have no meaning without the line f.a=ff;.
Bit i have a problem with this function in .NET.
When you convert a single with toPLCfloat an the Result is in LittleEndian not a number the .NET framwork change the value.
For example you convert the value 0.69915 with toPLCfloat() the result is QNAN.
When you write this value to the PLC you have the value 0.0027 because the .NET default value for QNAN is 0.0027.
I think i change the toPLCfloat function in .NET that they returns a ByteArray.
Greets Marco
The problem in the function toPLCfloat exists. There are 2 lines with f.a=ff; (line 1921 and 1929) if we remove line 1929 the function will work correct
to genesis_81 I think you have to use function daveToPLCfloat