Total Seconds to Minutes:Seconds

afish

Member
Join Date
Sep 2008
Location
OREGON
Posts
9
Hi All,



I have a SLC 500 & RSView 32 project that exports reports to Excel 2003. A portion of the report has a column with "total seconds" that grab the .ACC values out of specific timers in the PLC.

I would like to display the "total seconds" as mm:ss in the report. I don’t really care where the conversion takes place, either in the PLC or Excel.

I realize I can just divide the total seconds by 60 & that will give me the accurate "minutes". But then I am left with a fraction after the decimal point that I don’t know how to convert. I guess I should say, I don’t know how to separate the whole number from the fraction after the decimal point.

Any help would be appreciated. Thanks in advance.


afish
 
In your workbook formula, use:

=INT(TimerACC/60).....to get the whole portion (minutes) without the fraction. INT function rounds the value to the nearest whole number
=MOD(A1,60).....to get the remaining seconds. MOD finds the modulus


To get the whole thing formatted as you'd like:
=CONCATENATE(INT(A1/60),":",MOD(A1,60))

EDIT: more stuff needed to pad with zeros when applicable...
EDIT:

How about this:
=CONCATENATE(INT(A1/60),":",RIGHT(CONCATENATE("0",MOD(A1,60),),2))

And substitute your PLC address or cell reference for A1 in both places...
 
Last edited:
Also another manner, done in RSView32

Numeric display is for MM, the expression will be:
(Timer % 3600)/60
Field Length = 2
Decimal Place = 0

Numeric display is for SS, the expression will be:
Timer % 60
Field Length = 2
Decimal Place = 0

"Timer%60", returns the remainder of Timer divided by 60

:geek:

- [font=comic sans ms,sans-serif]fuzzy logic[/font]
 
Thanks for the quick replys,

OkiePc, I tried to substitute the PLC address for A1 but it didnt seem to work.
This is what I ended up with.

=(RSLINX|FPRL_RETORT1.2!'T11:15.ACC,L1,C1'/60),":",MOD(RSLINX|FPRL_RETORT1.2!'T11:15.ACC,L1,C1',60)

My original address is

=(RSLINX|FPRL_RETORT1.2!'T11:15.ACC,L1,C1'

Am I doing somthing wrong?
 
I just figured out what I did wrong. Thanks OkiePc, worked like a champ once I got the address corrected.

Thanks again,
afish
 
fuzzy logic said:
Also another manner, done in RSView32

Numeric display is for MM, the expression will be:
(Timer % 3600)/60
Field Length = 2
Decimal Place = 0

Numeric display is for SS, the expression will be:
Timer % 60
Field Length = 2
Decimal Place = 0

"Timer%60", returns the remainder of Timer divided by 60

:geek:

- [font=comic sans ms,sans-serif]fuzzy logic[/font]


Ok I have done this in RSView 32 and it works great as you explained. Is there a way to do this in RSLogix 5000 without having to do it in the HMI? I don't think RSView ME has the MOD function.

I think I just answered my question. There is a MOD instruction in RSLogix 5000. Guess it will do what I am trying to do. However it sometimes makes me anxious when doing all this math in the processor because you risk causing a fault if you are not careful, which I have done on a few occasions in the past.
 
Last edited:

Similar Topics

With some advice i got from this site, been working on a small project that i heating a plate and then letting plate cool and then reheat plate...
Replies
26
Views
10,441
I'm being tasked with supporting / upgrading these panels but no software, cable, documentation. I have an old laptop running XP and would like...
Replies
4
Views
1,996
Hi everyone, I'm trying to perform a serial download with a Total Control Quickpanel jr (QPK-2xxxx) using an old computer running QuickDesigner...
Replies
3
Views
1,681
Does anyone know where I might get a copy of development software for a TCP HMI?
Replies
4
Views
2,284
Is there a way to count the number of tags (including dot fields) in RSLogix 5000 automatically? When I export the tag database and open it in...
Replies
4
Views
3,016
Back
Top Bottom