PLC-5 Day of Week Counter

Introduction to the PLC-5 Day of Week Counter

A PLC-5 Day of week counter is an easy way to find the day of the week for certain events in automation. For example: You want to test an alarm every Monday at 10am. There are complex algorithms that will calculate the day of the week based on the current date. A simple counter is an easy, temporary solution. I refer to this as temporary because there are a couple drawbacks of using a simple counter vs. complex algorithms.

In the first place, the processor must be in run mode when it’s time for the counter to increment it’s value. Another important point is that when you download a program, you may need to manually adjust the counter’s accumulated value. All things considered, a simple counter would use less memory in the PLC-5. Also it would have a faster scan time than deriving the day of week from the date. Also be aware that if you are synchronizing the time over the network at midnight (with this example), it’s possible to trigger the day of week counter twice. For example: Your counter accumulates when the processor clock hits midnight. When you synchronize the time over the network, the clock might be set to 23:59:57. This could effective cause a “Second Midnight” each day.

In the newer SLC-500, the day of week is embedded in the Status file (5/03 and up). Check out this post for how to get the day of week on the SLC. The ControlLogix has a special add-on instruction that will derive the day of week. This add-on instruction is under the sample files in your project directory.

Add the logic

First, open the processor status and set the clock. This will ensure the processor knows when it’s midnight, when we update the day of week. Press “Set Time and Date” to load the time from your PC into the processor. Double check the system time to be sure it is correct.

Next, add the logic for the counter. This logic is only an example. Obviously, you need to change the address to a counter that you are not already using in your processor.

In the first rung, the EQU checks the current hour. Every time the hour is 0, the counter will accumulate. It’s important to realize that as soon as the counter hits an accumulated value of 8, it will reset (in the next rung). Normally, the counter would reset to zero. However, on the next scan your system’s hour is still 0. This causes the counter to immediately increment to the value of 1. Therefore, your effective values of the counter are 1 to 7.


In summary, using a counter is a simple and easy method to use few processor resources to find the day of week if other methods are not easily available. The PLC-5 has limited memory, so it might be the best method if you already have a large program.

If you implement this method, be aware of the situations that could cause an inaccuracy in the counts. Do not use this method for important system controls due to the unknown conditions that could cause an inaccurate count (such as power being off around midnight for an hour).

For other information on PLC-5, visit the category page.

— Ricky Bryce

Leave a comment

Your email address will not be published. Required fields are marked *