Byte Array to Real
-
Dear Unipi Support Team,
in a function block I want to assign a byte array (4Bytes) to a real? All variants I've tested ends in the normal int interpretation. -
Hello @Neuron_Flo,
what is the source of these 4 bytes? Do you read them from some HW prototype?Martin
-
Hi Martin, from a tcp connection:
received := io.readport(handle, adr(dataRecv[0]), 9);I have a real of 4bytes in the byte array.
-
Hello @Neuron_Flo,
we tried different approaches, but non of them gave the correct result. There doesn't seem to be a native way how to transform this data in ST code. It looks like you need to resort to the classic calculation according to: https://en.wikipedia.org/wiki/Single-precision_floating-point_formatMartin