You are on page 1of 2

Rockwell Automation Support Center

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


Access Level: TechConnect
Date Created: 02/22/2000 04:03 PM
Last Updated: 11/15/2013 05:02 PM

Background:
In certain applications it may be desirable to display the Accumulated Value of a PLC or SLC timer in a numeric display that shows the accumulated seconds in
Hour:Minute:Second Format.
Solution:
You can add a calculation in several numeric displays that converts the accumulated seconds into hours, minutes and seconds. By dividing the accumulated time by 3600,
hours are displayed. Taking the remainder and dividing by 60 results in minutes. Finally, the remainder of the accumulated timer divided by 60 will produce seconds. The
modulus operator (%) is the key to this operation. "Timer%60", for example, returns the remainder of Timer divided by 60. Using this operator, hours, minutes and seconds can
be extracted from the accumulated time.
Example
The accumulated time is contained in a tag called "Timer". The following setup is for 1 timer accumulator. For each Timer Accumulator, you will have 3 numeric displays .
HH:MM:SS
First numeric display is for HH, the expression will be:
Timer / 3600
Field Length = 2
Decimal Place = 0
Second numeric display is for MM, the expression will be:
(Timer % 3600)/60
Field Length = 2
Decimal Place = 0
Third numeric display is for SS, the expression will be:
Timer % 60
Field Length = 2
Decimal Place = 0
Note: 100 timer displays have been tested on a screen with no problem.
The graphic may look something like the following example:
HoursMinutesSeconds
2

29

16
Actual Timer Value
8956

RSView Enterprise Exception (SE and ME)


RSView Machine Edition and Supervisory Edition will experience the following error message when trying to implement the expressions above. This is due to the expression
creating a floating point number. From the RSView Help "You cannot perform modulus or bitwise operations on floating point numbers". The Example below demonstrates an
expression that obtains the desired result without error.
Error message
Unable to activate connection (Timer) % 60
Invalid expression: '(Timer) % 60: 'Error at line 1, column 14: Invalid Floating point operation'
Example
Perform the modulus done before division:
For minutes: ( ({[ControlLogix]Timer.acc}%3600000)/ 1000)/60
For seconds: ({[ControlLogix]Timer.acc}%60000)/ 1000

Comments (0)
This answer has no comments

Post a Comment

Product Tree for This Answer (expand/collapse)

DISCLAIMER
This knowledge base web site is intended to provide general technical information on a particular subject or subjects and is not an exhaustive treatment of such subjects.
Accordingly, the information in this web site is not intended to constitute application, design, software or other professional engineering advice or services. Before making any
decision or taking any action, which might affect your equipment, you should consult a qualified professional advisor.
ROCKWELL AUTOMATION DOES NOT WARRANT THE COMPLETENESS, TIMELINESS OR ACCURACY OF ANY OF THE DATA CONTAINED IN THIS WEB SITE AND
MAY MAKE CHANGES THERETO AT ANY TIME IN ITS SOLE DISCRETION WITHOUT NOTICE. FURTHER, ALL INFORMATION CONVEYED HEREBY IS PROVIDED TO
USERS "AS IS." IN NO EVENT SHALL ROCKWELL BE LIABLE FOR ANY DAMAGES OF ANY KIND INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL,
LOSS PROFIT OR DAMAGE, EVEN IF ROCKWELL AUTOMATION HAVE BEEN ADVISED ON THE POSSIBILITY OF SUCH DAMAGES.
ROCKWELL AUTOMATION DISCLAIMS ALL WARRANTIES WHETHER EXPRESSED OR IMPLIED IN RESPECT OF THE INFORMATION (INCLUDING SOFTWARE)
PROVIDED HEREBY, INCLUDING THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, AND NON-INFRINGEMENT. Note that
certain jurisdictions do not countenance the exclusion of implied warranties; thus, this disclaimer may not apply to you.

This page is best viewed in Internet Explorer 7, Firefox 3.5, Chrome 4, Safari 4 or newer.

You might also like