Reading / Writing to a TIME Datatype with Correct Formatting

Morning all,

I'm looking for the best way to approach this problem, as no doubt its been done before many a time.

I have a S7-1500 PLC that I am connecting to using onboard OPC UA.
Within this PLC I have a number of setpoints that are of datatype TIME.
Ignition reads these into tags as integers that are formatted as milliseconds. I.e. 60s would be 60000.
Running ignition perspective 8.1.25

I am making a setpoints page where the user can view, and change the various different setpoints.
For a time, I would like to display this in seconds/minutes/hours (which ever is most applicable).
I would also like that they could edit the setpoint in the same format.

What is the best way to go about making a input/output field that can format the integer correctly to show the user, and then also do the opposite conversion to write back to the PLC correctly?
For example, in the case above, the input box would need to take the 60000 and display 60s, but if changed to 120s, write 120000 to the PLC.

I'm sure theres many a way of doing this... but whats the best / most efficient? :smiling_face:



I use a linear scaling mode on the tag.

1 Like