day of week

This is from the Rockwell site. Ran it in emulator and works fine.


39569 - DayOfWeek (Logix Platform) : How to calculate the Day of the Week


Access Level: TechConnect
Date Created: 04/26/2007 01:51 AM
Last Updated: 01/15/2015 01:43 PM


Question

How to calculate the current Day of the Week (DayOfWeek) ?



Answer
1.RSLogix 5000 -> Help -> Vendor Sample Projects -> DayOfWeek.ACD
2.By browsing hard drive: RSLogix5000/Projects/Samples/ENU/Vxx/Rockwell Automation/DayOf Week.ACD. Where Vxx is version number of RSlogix5000.
3.alternative approach, refer to the (DayOfWeek_CurrentTime.zip) file attachment below
 
If you are using a Panel in your application you can get the Weekday from the system tag system\DayOfWeek using a very simple Macro with FactoryTalk View.
 
There is a "DayOfWeek" AOI in the "Samples" folder for many versions of the software.

It calculates it from the date you GSV from the real-time clock.

There is no need to continually execute this, the day only changes once in 24 hours, so I would recommend you only execute this once per day (at midnight, use a ONS - Hour=0, Minute=0, and Seconds=0), or on S:FS. This will ensure the day is correct even if the processor has been turned off.

EDIT : perhaps I should have checked page 2 of the thread, recommending the same AOI, but my advice when to execute it is still valid.....
 
Last edited:
There is a "DayOfWeek" AOI in the "Samples" folder for many versions of the software.

It calculates it from the date you GSV from the real-time clock.

There is no need to continually execute this, the day only changes once in 24 hours, so I would recommend you only execute this once per day (at midnight, use a ONS - Hour=0, Minute=0, and Seconds=0), or on S:FS. This will ensure the day is correct even if the processor has been turned off.

EDIT : perhaps I should have checked page 2 of the thread, recommending the same AOI, but my advice when to execute it is still valid.....

There is a bug with this AOI if you are on earlier versions of RSL 5000
 
There is a bug with this AOI if you are on earlier versions of RSL 5000

Can you be more specific on the nature of "the bug". What versions does it fail on ?

The AOI uses simple math instructions, so can't see it being version independent....

I tested it on V16, when AOI's were introduced, and couldn't find a fault in it.
 
Can you be more specific on the nature of "the bug". What versions does it fail on ?

The AOI uses simple math instructions, so can't see it being version independent....

I tested it on V16, when AOI's were introduced, and couldn't find a fault in it.

Let me find the Rockwell memo that states this.

If my memory serves me (Often does not) it would make the PLC jump to a significantly higher year than it should be.

I believe the version of the RSL was V20.
 

That was a firmware issue on the controller causing the year jump on the WallClock, as stated in the thread linked, "it has nothing to do with the AOI."

The DayOfWeek AOI does not write to the WallClock, it simply uses values GSV'd from it.

Having said that, I have an L62 that has been running r20.11 for years, and have never seen the clock jump to 2117, but I've just flashed it, just in case....
 
Sorry about that. Like I said, my memory fails me at times.

I just remembered it being an issue and thought I would bring it up.
 

Similar Topics

Hi All, I'd like to know can we use DTR instruction to get a week pulse ? Could anyone please help me to understand that one ? I've managed to...
Replies
4
Views
174
The day of week program started changing day of week 2 hours early. It changes at 10 P.M. instead of 12A.M. Just started this year.
Replies
22
Views
2,646
For some reason that I do not understand, FactoryTalk is showing the Day of Week in the time and date display, despite the fact that this isn't an...
Replies
5
Views
1,219
This is the reason why I signed up here and decided to get some help before I tackle the traffic light program on Wednesday. It looked good on...
Replies
17
Views
11,678
Hey everyone. I am trying to create some logic that will turn on an output only during production times. M-F 5am to 3:30pm. The output is for...
Replies
3
Views
1,357
Back
Top Bottom