Good application Mike, this program should do it:
10 IF INTERVAL(0:0:01) AND OUT1 THEN P1R = P1R + 0:0:01
The INTERVAL statement triggers once every second, if output1 is on at that time then the run timer will be incremented. Otherwise the line doesn’t fire at all and the timer stays where it was. The P1R variable should be in the units of time.
Thanks again Maurice.
I created 1 (time) variable and 3 virtual counters (seconds, minutes and hours) to memorize the running time, in case the T3 reboots or loses power. If I understand correctly, variables are erased but not counters. Few code lines and voilà, it works as expected.
Actually if you use the TIME range for the units on the variable you can store the hours minutes and seconds in a single variable instead of the three separate variables.
Indeed. But I separated them because I had problems to send the time value to my plc and node-red (int16). I’m a lazy guy, so I made those 3 virtual counters to retrieve the important one (hours of working) and poll directly that float with my plc / node-red, without any strange conversion
Please confirm also that variables could be erased in case of T3-xx reboot but values are kept if stored as counters