FactoryTalk - Seconds to MM:SS

ShacharY

Member
Join Date
Jan 2015
Location
CA
Posts
16
Hey,
I'm trying to convert seconds to MM:SS view.
using tag: PLC\IN_CCD_TIME (integer) from PLC timer.
Numeric tag (HMI) MM: PLC\IN_CCD_TIME % 3600 / 60 SS: PLC\IN_CCD_TIME % 60
when seconds reach 59 then switch to 00, the minutes not added 1 only when seconds pass the 30. i know that's all about floating point.
Must to use seconds on PLC and use it for HMI as MM:SS.

need any help to use seconds as MM:SS,
Thanks!
 
Hey rdrast,
I know about the 3600 that isn't relevant.
The problem is about counting the MM. for example:
(PLC) T4-XX (sec) & (HMI) Elapsed Time - MM:SS
T4-20 Elapsed Time-00:20
T4-29 Elapsed Time-00:29
T4-31 Elapsed Time-01:31
T4-59 Elapsed Time-01:59
T4-60 Elapsed Time-01:00
T4-61 Elapsed Time-01:01
T4-89 Elapsed Time-01:29
T4-90 Elapsed Time-02:30
T4-91 Elapsed Time-02:31

The T4 (INT) at any time passing the 0.5% after HMI division, the MM add 1. and after passing the 59 sec the MM not added 1.

Thanks.
 
I'm using INT.
As you said, the table is completely wrong but this is how i see the calculation of the MM in the HMI. :cry:
 
Suspecting some rounding with the /-function.
Where 0.5 is considered 1.


EDIT:

((PLC\IN_CCD_TIME % 3600) - ((PLC\IN_CCD_TIME % 3600) %60)) / 60

That will prevent any rounding issues. In theory; I think. Not tested. Not sure it's a valid expression.


But why do this in the HMI, not in the PLC? (just wondering)
 
Last edited:
Suspecting some rounding with the /-function.
Where 0.5 is considered 1.


EDIT:

((PLC\IN_CCD_TIME % 3600) - ((PLC\IN_CCD_TIME % 3600) %60)) / 60

That will prevent any rounding issues. In theory; I think. Not tested. Not sure it's a valid expression.


But why do this in the HMI, not in the PLC? (just wondering)


Super! that's work perfect!
Many thanks!
 
Last edited:
Another way...

See also...

7771 - Displaying a Timer Accumulator value in Hour:Minute:Second format
Access Level: TechConnect

In short...

Create two numeric displays and use these expressions...

For minutes: ( ({[ControlLogix]Timer.acc}%3600000)/ 1000)/60

For seconds: ({[ControlLogix]Timer.acc}%60000)/ 1000

Regards,
George
 

Similar Topics

I have a numeric display which currently displays a value (Specified by Connections>Value field) However I want it to add an "s" or "sec" after...
Replies
8
Views
5,731
I have two identical machines running similar HMI projects, the only difference is one is done in FactoryTalk View Version 10 and the other is...
Replies
5
Views
215
how to communicate FactoryTalk Optix and Mitsubishi Q Series. I want to know the details of that
Replies
0
Views
51
Hoping someone can give me some guidance or confirmation of what I need to do. We have a FactoryTalk SE program that I need to change the IP...
Replies
2
Views
109
We are a water/wastewater plant, collecting realtime and manually entered data. We have been using FactoryTalk Historian (OSI PI) for real time...
Replies
3
Views
146
Back
Top Bottom