Showing Remaining Minutes and Seconds on and HMI

dmayhugh

Member
Join Date
Sep 2016
Location
Michigan
Posts
48
I need to show remaining minutes and seconds on and HMI using ControlLogix 500. I am searching for a sample code and have not found one. Any help would be appreciated.

Thank you
 
Hi,
Let say Timer_Test is your timer.
You can create the tags Remaining_Seconds and Remaining_Minutes.
Remaining_Seconds = (Timer_Test.PRE - Timer_Test.ACC)/1000
I'm dividing into 1000 because timers in RSLogix 5000 are in milliseconds.
Remaining_Minutes = Remaining_Seconds /60

I hope this helps.
 
Yes. Works for 500 as well as 5000

Pre and Acc words exist for timers. Just your addresses and timer preset will change.
 
On the HMI I need to show remaining minutes and seconds. For example 15:00, 14:59, 14:58, 14:57 etc With the reference above I am assuming I would be showing all te remaining seconds as well as the remaining minutes. Am I correct?
 
On the HMI I need to show remaining minutes and seconds. For example 15:00, 14:59, 14:58, 14:57 etc With the reference above I am assuming I would be showing all te remaining seconds as well as the remaining minutes. Am I correct?

You have to do some math.

Remaining seconds divided by 60 = remaining minutes (plus fraction)
So subtract the whole number minutes from the Floating Point minutes, to get the remaing fraction.
Multiply the remaining fraction by 60 to get the remainder in seconds.

So 90 seconds remaining, divided by 60 = 1.5 minutes
1.5 - 1 = 0.5 minutes as a remainder.
0.5 * 60 = 30 seconds as a remainder

90 seconds = 1 minute 30 seconds.

Usually I just Move the 1.5 to a INTeger, Then if the INT is greater than the original Floating Point, I subtract 1 (force round down in case it ever rounds up).
 
On the HMI I need to show remaining minutes and seconds. For example 15:00, 14:59, 14:58, 14:57 etc With the reference above I am assuming I would be showing all te remaining seconds as well as the remaining minutes. Am I correct?

I would do it this way:

Remaining_Minutes (INT) = (Test_Timer.PRE - Test_Timer.ACC)/60000
Remaining_Seconds (INT) = MOD((Test_Timer.PRE - Test_Timer.ACC)/60000)

If mod is not available (been a while since I used RsLogix 500) then I would do the following:
Remaining_Minutes (INT) = (Test_Timer.PRE - Test_Timer.ACC)/60000
Remaining_Seconds (INT) = ((Test_Timer.PRE - Test_Timer.ACC) - (Remaining_Minutes * 60000))/1000

NOTE: I´ve not tested this second one so there may be a rounding error, not 100% sure what the result would be in RsLogix 500 if I divide 3/2 if it returns 1 or 2.

I hope this helps
Regards
Ian
 
This is a snippet of my standard logic out of my machines. Running on a couple hundred ML1400 processors around my shop.

I just force a round down, even if the PLC never rounds up. Because at the time I made it, I did not know if the MOV instruction would round up ever, and rather than leave it to test, the logic to force the round down was not difficult.

Timer has a time base of 1 second in my example. You would have to adjust your dividing constants if your time base is different.

Edit:
Note, this is just converting the ACC timer to Hours/Minutes/Seconds. Not actually remaining time, which would require Preset minus Accumulator, then all the conversion logic.
 
Last edited:
Good thing about the PLC doing the math is you aren't then limited to using HMIs that can handle scripting.

Sometimes the machines I use have very low cost, low feature, HMIs.
 
Good thing about the PLC doing the math is you aren't then limited to using HMIs that can handle scripting.

It's more of an issue with presenting the math results in a proper "HH:MM:SS" format for display rather than doing the actual math. Granted if you are using a low-end HMI you pretty much have to make it work however you can.
 
Usually I just display the three Integers I create in the PLC, separate, but formatted on the screen so they are close together with either wording or a fixed ":" in between them. It appears as one display, but in reality is three separate ones.

Try to make things as independent from the HMI as possible. Were the HMI is merely a device to display things, rather than actually do any logic. I think it leaves me open to switching brands and applying basic usage cross multiple brands, but that is just my preference.
 
usually i just display the three integers i create in the plc, separate, but formatted on the screen so they are close together with either wording or a fixed ":" in between them. It appears as one display, but in reality is three separate ones...
+1
 
Several posts in this thread about doing the math in the PLC, and that is the way I would go......

But watch out for the different ROUNDING method used in Logix5000 (ControlLogix, CompactLogix, etc.).

MicroLogix uses the "traditional" 0.5 and above = Round Up....

Logix5000 uses "round to even" method when the math result is exactly xxx.5

Examples (NB a simple MOV instruction shows this):-

MicroLogix - MOV, 2.5, N7:0 - N7:0 would be 3, result is rounded UP
Logix5000 - MOV, 2.5, A_DINT - A_DINT would be 2, result is rounded to nearest even number
BUT :
Logix5000 - MOV, 1.5, A_DINT - A_DINT would also be 2, result is rounded to nearest even number

"forcing" rounding down (or up), is therefore no longer simple in Logix5000 platforms.
 

Similar Topics

Processor : PLC5 I have an situation where I need to set a time into the Panelview HH:MM:SS (N7:10, N7:11, N7:12). This time is the total time...
Replies
4
Views
4,230
Good morning, We've had an issue with a couple of servo valves and was wondering if anyone had seen anything similar. After a drop in pressure...
Replies
2
Views
93
Hello, I am using a Hitachi Micro EHV+ for a small project, and I wanted to have a Web visu, done with Codesys V3.5 SP13 Patch 2. I test the...
Replies
6
Views
294
Hello. I am working in FTVSE v8. I have many trends set up some of them work others do not. The ones that don't work show the foot print of the...
Replies
3
Views
239
Hello everyone, I am working in a platform and we installed FTV CLIENT SE V 12 IN ALL THE CLIENTS COMPUTERS, we have 6 clients and only 1 is not...
Replies
0
Views
100
Back
Top Bottom