How to Create a Running Hour Counter for ML1200 PLC in RSLogix 500: Step-by-Step Guide

Question:

Hello everyone! I'm looking to implement a running hour counter in the program for an ML1200 PLC, which I would like to display on an HMI. I'm not entirely sure which instructions to use for this task. Has anyone had experience with this before? Any guidance would be greatly appreciated. Thank you! Best, Stu.

Top Replies

To configure the input of an RTO timer based on an ON condition, designate a contact that will serve this purpose. Set the timebase to 1 second and the preset value to 3600 seconds. Once the timer reaches the done state (DN), increment a Long type variable and reset the timer. Finally, display the updated Long value for easy monitoring.

Hello Berni, Thank you for your response! Could you please clarify what you mean by incrementing a Long data type? I'm a bit unclear on that aspect. I appreciate your assistance! Best, Stu

Stu said: "Hi Bernie, thanks for your assistance! Could you clarify what you mean by incrementing a Long type variable? I'm a bit uncertain about this aspect. I appreciate your help!" The MicroLogix controller does not support a Long (or DINT) data type. However, you can effectively utilize an integer for your hourly accumulator. I typically implement additional logic to reset the accumulator when it approaches its maximum limit of 32,767. Given that the maximum value is 32,767 hours, your meter will reset after approximately 3.7 years of continuous operation. If you require a longer measurement of elapsed time, you will need to use multiple integers. For instance, your timer can count up to 3,600 seconds (equivalent to 1 hour) and then increment an integer, such as N7:10 (representing hours). When that integer reaches 10,000, you can then increment a second integer, N7:11 (each representing hours multiplied by 10,000), and reset N7:10 back to 0. This approach allows for effective tracking of long-term elapsed time in your application.

The original poster (OP) is utilizing an ML1200 PLC, which indeed supports the Long data type. To implement this functionality, you should incorporate an L file in your programming. For example, to manage the timer (RTO T4:0), use the rung with the instruction **XIC** (Examine If Closed) to check if the timer is running: `XIC T4:0/DN`. Additionally, to enhance your processing, you can add values using `ADD L9:0 1 L9:0` and subsequently reset the timer with `RES T4:0`. Alternatively, you can set a preset value of 36 seconds to track in hundredths of hours. Keep in mind that the Long data type can accommodate values up to 2,147,483,547, ideal for extensive counting requirements in industrial applications.

Alaric mentioned that the operation is utilizing an ML1200, which indeed supports a Long data type. To proceed, you should create an L file. Here's a simplified logic: //timerXIC Running RTO T4:0 1 3600 0//hour counterXIC T4:0/dn bst Add L9:0 1 L9:0 nxt RES T4:0 bnd. Alternatively, you can set a preset value of 36 seconds and track hundredths of hours since a Long data type can count up to 2,147,483,547. Hi Alaric, thank you for your help! I’m still learning the basics of programming, so could you explain it in simpler terms? What does “nxt” mean? Should I use L9:0 as my display tag? And if I want to use minutes, would it be the same formula? Best regards, Stu.

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.

Frequently Asked Questions (FAQ)

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  →