Show elapsed time on intouch

Posted on 322 views

Assume we got an integer number that means the seconds count, and we need to show it as the time period on intouch, such as the PLC communication lost period.

Here is some steps you shoud do.

Tagnames:
In the tagname dictory ,we should define some tags:
tSecondCounts        //Define as I/O integer, and max of 65535 , min of 0
tSec                         //Define as memory integer, and max of 59 , min of 0
tMin                          //Define as memory integer, and max of 59 , min of 0
tHour                       //Define as memory integer, and max of 23 , min of 0
tDay                        //Define as memory integer, and max of 65535 , min of 0
ofcourse you can define the tSecondCounts as memory integer too, if you wanna debug it.

Script:
In the datachange script module, add a new script , select the tagname of $Second and write the scripts as follows:
tDay   = tSecondCounts / 86400;
tHour  = (tSecondCounts MOD 86400) / 3600;
tMin   = (tSecondCounts MOD 3600) / 60;
tSec   = tSecondCounts MOD 60;

Now , you get the day, hour, minute, second of the elpsed time.

Here is a project sample written with intouch 10.1, you can download it if you can’t understand what i’m saying.

One thought on “Show elapsed time on intouch

Leave a Reply

Your email address will not be published. Required fields are marked *

9 × = 36