Insight's Inbox: I have a ControlLogix, how do I access the controller's clock?

Today we’re kicking off a new series entitled, “Insight’s Inbox,” which are articles based on the reader email questions we receive.

RSLogix5000 Splash Compact Control Featured ImageReader Question:

I would like to enable some ControlLogix code when it’s between 8am and 5pm, Monday through Friday.

How do I do this?

Insight’s Answer:

Logix DateTime Off By HoursYou’re in luck, this is definitely do-able with the ControlLogix.

Here are the two steps I would take to make this work:

Part 1) What time is it?

The first step is to find out the current time, which you can read from your processor using a GSV instruction.

Unlike the PLC-5, SLC-500, and MicroLogix, all of which have a status file, to access similar information in a ControlLogix or CompactLogix requires a GSV (get system variable) or SSV (set system variable) instruction.

In this case, to get the time you would use the GSV instruction to read from the WALLCLOCKTIME object and put those values into a tag array of seven DINTs.

Note: More information about the WALLCLOCKOBJECT can be found in the ControlLogix instruction set reference manual.

Learn to Program ControlLogix Programmable Controllers

Next, in the sample code which comes with RSLogix 5000 there is a program called, “DayOfWeek.ACD” which you can use to calculate what day of the week from the time.

At this point you’ll have both the current time and the day of week, so you’re now ready for step 2 below.

Part 2) Compare the current time and day to your operating range

Now that you have the current time and day of week in your Controller Tags, you’ll do some comparisons.

The first comparison I would do is for the day of the week – if it’s Saturday or Sunday then you code would not run according to your schedule and you don’t need to do any additional comparisons.

The second comparison I would do would be if it’s before 8am. If it is, then your code again would be not run according to your schedule and there’s no need to do the next comparison.

The final comparison I would do would be to check to see if it’s after 5pm. If this last compare is not true then your code should run as the current time is between 8am and 5pm, Monday through Friday.

I hope this article base on an email conversation with a Insight’s reader was helpful.

If you have anything you would like to add to the above conversation, or have a question, please don’t hesitate to use the “Leave a reply” for at the bottom of this page.

Update: If you have your own question you’d like to ask, please post it as a comment on a related post here at


Shawn Tierney
Automation Consultant
Insights In Automation

Did you find my article helpful? Why not become a Premium Member with a small donation, and in return I'll give you a coupon for $10 of my automation downloads! Find out more here

The Automation School – PAC Basics – Article Banner Top