Mas01
Member
In S7/TIA Portal, is there a function to round a real to a specified number of decimal places?
e.g. If I have 22.519432 and I want to round it to 2dp, I get 22.52.
Thanks
I'm asking because the operator says that the data that gets recorded into the CSV file is shown as 7 d.p. and they only want it to be 2 d.p. to match the HMI-displayed value (which is true, it's shown to 2dp on-screen).
I thought it might be the ROUND instruction, but I think that rounds to the nearest integer.
Is there an instruction? Or do I need to use VAL_STRING to do this?
Thanks
e.g. If I have 22.519432 and I want to round it to 2dp, I get 22.52.
Thanks
I'm asking because the operator says that the data that gets recorded into the CSV file is shown as 7 d.p. and they only want it to be 2 d.p. to match the HMI-displayed value (which is true, it's shown to 2dp on-screen).
I thought it might be the ROUND instruction, but I think that rounds to the nearest integer.
Is there an instruction? Or do I need to use VAL_STRING to do this?
Thanks