Extract Hours/Minutes/Seconds from S5TIME Format - II
In the previous practice we dealt with this same example, but after converting BCD_I, this time we will deal directly with the variable assigned to DEZ. When we configure it in the variable table of our Screen, we will assign it the data type S5Time.
The only drawback is that the time is shown in milliseconds, so we need to convert the milliseconds to Seconds, Minutes, and Hours.
We have the same example:
The Script is as follows, the line HmiRuntime.Trace is not applicable just like ShowSystemAlarm, it needs to be commented out...
What we are going to do is first divide the milliseconds by 1000 to get the seconds, and from the seconds, we will perform a series of divisions to extract all the information.
And finally, we will check the operation. The result is satisfactory, it works perfectly.
A detail that I overlooked is that the Script will be executed every time the value of our variable changes, we go to the properties of our variable and in the events, on value change, we execute the Script.
January 26, 2014