How to Convert IEEE 32 Bit Floating Point value to Real datatype in control builder, 800xA?
In modbus rtu the data type of register data is IEEE 32 bit floating Point.
How can I convert it into real values?
for example:
43700000(32Bit Floating point) is equal to 240.0(real)
40466666 is equal to 3.1
Voted best answer
In control builder is there a function: words_to_real
words_to_real(real, word1, word2, BigEndian)
Converts 2 word values to a real.
The BigEndia n parameter is of bool type, indicating which of the two bytes in each word that is the most significant byte. word1 is the most significant word.
Examples
BigEndian = true, word1 = 16#407A and word2 = 16#3D71
Result: real = 3.91
BigEndian = false, word1 = 16#7A40 and word2 = 16#713D
Result: real = 3.91
The floating point format for the words_to_real firmware function is according to IEEE-754.
Answers
You can find the calculation on Wikipedia...
however i guess you ask about existing Functions to use, for the AC800M Controller you could take dword_to_real or words_to_real for this kind of conversion
Attached here with logic image the way it is implemented in Freelance, same way you can try in ac 800m, if that works then upload it as app on AKS so that community can use those blocks in future.
Also attached here with related threads.
http://www402.abbext.com/Is-convert-I...
Hope that helps
Add new comment