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

The Automation School – PAC Basics – Article Banner Top

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 Blogger and Trainer

Need personalized help? For as little as $25 per month you can get direct access to ask me Rockwell PLC, HMI, and SCADA questions! Learn the details at

The Automation School – PAC Basics – Article Banner Top

Check Also

What’s New in Studio 5000 Logix Designer v30

Version 30 of Studio 5000 Logix Designer programming software has been release for Rockwell’s 5370 and …

Last chance to pre-order my eight hour ControlLogix video training course for just $99!

After working on it for many weeks, today I’m happy to announce that I’ve complete my …