Hi all,
I am programming my PLC (TM251MESE), and my code is supposed to stream sensor REAL values to Modbus Device. However, I have to limit my decimal points to one. To do so I have made a function block, where I multiply the real value by 10, then use the "trunc" function to get rid of decimals, and finally multiply by 0.1 to have the desired value.
Most of the time this works fine, but sometimes I get a value with many decimals following the configured value. Any ideas how to overcome this problem? Thanks
I am programming my PLC (TM251MESE), and my code is supposed to stream sensor REAL values to Modbus Device. However, I have to limit my decimal points to one. To do so I have made a function block, where I multiply the real value by 10, then use the "trunc" function to get rid of decimals, and finally multiply by 0.1 to have the desired value.
Most of the time this works fine, but sometimes I get a value with many decimals following the configured value. Any ideas how to overcome this problem? Thanks