This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi
I have programmed the modbus read holding registers to read int and float values from MCU, but for the real number it has to be as per the IEEE 754 standard so my applicable can be compatible and integrated with 3rd parties master modbus devices.
my question: is there any standard library for float to int32 IEEE 754?
BR
Hani
Hi Hani,
If you need transmit IEEE 754 float number via Modbus you should not convert float to integer. You should simple send float number via two Modbus registers. Only important this is a which endian is supported by your Modbus master.
BTW ... it does not exist anything like a int32 IEEE 754.
Jan
Hi Jan
my concern is how to translate the float to IEEE754, then sending the IEEE754 over modbus.
BR
Hi, this is what i want to get, is there any CCS tool / library supporting this?
Hi,
Yes, all float point variables and calculations are nativity done at IEEE754. Also TM4C1294 have FPU (Floating-Point Unit) for single-precision flaot calculations (=IEEE754).
Jan
Hi,
Why you need extract exponent and mantissa from float? If you want send separately exponent and mantissa in two Modbus registers, then I am almost 100% sure that Modbus master will not be able deal with this. When you send IEEE754 float via Modbus then exponent and mantissa are not send separately. Please read this.
Function for working with IEEE754 floats you find at <math.h> -e.g. https://www.tutorialspoint.com/c_standard_library/c_function_frexp.htm
Jan
Hello Hani,
This isn't really a device specific question and is outside of the scope of what we support on E2E. You may want to try asking this on a place like StackOverflow which deals more in software topics like this.
Or maybe further dialogue with Jan may help.
In any case, this isn't something we at TI can assist with as it's outside of our scope of knowledge - we are device experts for our parts, but don't have in depth knowledge of standards like IEEE 754.