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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login