Help with rslogix 5000

stu

Member
Join Date
Aug 2005
Location
England
Posts
772
Hi guys
I have a machine that we what to reset a counter to zero on Sunday at 6pm
I have seen the ssv, gsv and the wallclocktime but have never used them
Could someone show me how I could do this please, also is it possible to record the number before it resets, I am using a compactlogix and a pop 700 .
Thanks stu
 
1) Create two DINT[7] arrays, one to SET the time, one to GET the time. The format for the arrays are:

[0] - Year
[1] - Month
[2] - Day
[3] - Hour
[4] - Minute
[5] - Second
[6] - Millisecond

2) To set the time call a SSV instrusion in ladder with the "Class Name"=WallClockTime, and "Attribute"=LocalDateTime and "Source"= the first element of your set array (e.g. SET_TIME[0]); "Instance Name" can be left blank. I'd put a set bit and a ONS in front of this instruction so you don't constantly try to set the time

3) To retrieve the time call the GSV instruction with the same parameters as the SSV instruction but this time the "DEST" should be your the first element of your get array( e.g. GET_TIME[0]). I wouldn't put anything infront of this instruction and place the program in a periodic task.

4) You have the year, month, and date but you do not know what day of the week it is (Sunday - Saturday). To get this you should look at algorithm called the "Zeller's Congruence". When you look it up in Wikipedia, please note that the straight brackets with the edge on the bottom are actually symbols for round down to the nearest number; this can be done in the PLC with the TRN instruction.

5) From there trigger your RESET on Day of the week, hour, and minute, but be sure to use a ONS when resetting so that you don't hold the RESET for a entire minute.

Hope that helps
 
Or...You could setup a "One Week Free Running Clock" Timer (Preset=604800000ms) which should be initially reset on any Sunday at 6pm.
From this point on the timer will time out every 7 days.
When the timer's .dn bit is true capture the .acc value of the counter (and eventually load it into an array) and then (RES) both the timer and counter's .acc values.
 
Last edited:
Or...You could setup a "One Week Free Running Clock" Timer (Preset=604800000ms) which should be initially reset on any Sunday at 6pm.
From this point on the timer will time out every 7 days.
When the timer's .dn bit is true capture the .acc value of the counter (and eventually load it into an array) and then (RES) both the timer and counter's .acc values.


No No No No No No No No NO NO NO NONONONONONONONO!

If you have a Real Time Clock available, USE IT. Timers are NOT guaranteed accurate. They are good, but not exact.
The same for periodic tasks and interrupts.

If you are driving a screw, you use a screwdriver. Yes, a hammer MIGHT do the job, but not properly.
 
I agree you cannot use a free running RTO within an extended (>seconds 10^6) time dependent high accuracy (seconds^-3) application.
Yes you could GSV the WallClockTime and then implement the "Day_of_the_Week" Logix5000 AOI sample programming in order to reset a counter. (It doesn't look bullet proof to me either!)
However, we are talking about "ONCE A WEEK" decision making programming that has to be implemented by someone who has never used the advanced features of the Logix systems.
If the user is aware that the Upload/Save/Download consequential actions will introduce a +/- RTO .acc error this could be easily compensated for. How many times you have to download to an operational modern processor anyway?
 
Yes you could GSV the WallClockTime and then implement the "Day_of_the_Week" Logix5000 AOI sample programming in order to reset a counter.

The Day_Of_Week AOI does not reset a "day counter" - it returns the actual day of the week calculated from the date, so will always be correct if the date is set correctly.
It doesn't look bullet proof to me either!)
I tested the AOI for all dates 2000 to 2116 and can confirm it lives up to expectations.
How many times you have to download to an operational modern processor anyway?
Once would be enough to shift the time away from 6:00 pm. Downloads may occur frequently during commissioning stages, and I would not want to have to keep calculating what to set the accumulator to achieve the next time-out at 6:00 pm on the next Sunday.
The specification calls for something to happen at a specific time, not after a specific 7-day delay, and to me, that calls for a real-time clock, not a timer.
 
Quote:
"The specification calls for something to happen at a specific time, not after a specific 7-day delay, and to me, that calls for a real-time clock, not a timer."

The specification calls for something to happen at a specific time ONLY AFTER a specific 7-day interval has elapsed. (See Post #1)
IMO this primarily is THE REQUIREMENT INTENDED TO BE SATISFIED WHEN ONE FIRST DESIGNED A TIMER.

Quote:
"The Day_Of_Week AOI does not reset a "day counter" - it returns the actual day of the week calculated from the date, so will always be correct if the date is set correctly."

Again, if we are researching the "scope" of this thread, we arrive at the conclusion that it is nothing more than : A WAY TO RESET A COUNTER AT 18:00 HOURS EVERY GIVEN SUNDAY.

The WallClockTime AND the DayOfTheWeek AOI implemented logic NEEDS TO RESET A COUNTER which's .acc value has to be recorded priorly to "zero-ing". It is the most elegant way to do it for most of the " helpers" within any automation forum.

However, when the request for help comes from someone not too familiar with the full capabilities of a system, I have always thought that a more basic alternative COULD BE considered and not completely (and rudely) dismissed.

Maybe the Midwest KISS engineering attitude is the culprit! Yep, the one that created Logix...
 
Last edited:
I have to disagree with you dmargineau, stu's post specifically says...

"I have a machine that we what to reset a counter to zero on Sunday at 6pm"

Nothing more, nothing less. There is no mention of an ONLY AFTER...

The DayOfTheWeek AOI tells you the day number from the WallClock date, and the WallClock Time will tell you when it is 6:00 pm.

These facts can be used to Reset the Counter after recording it's value.

Your suggested method will also NOT compensate for DST.
 
Quote:

However, when the request for help comes from someone not too familiar with the full capabilities of a system, I have always thought that a more basic alternative COULD BE considered and not completely (and rudely) dismissed.

Maybe the Midwest KISS engineering attitude is the culprit! Yep, the one that created Logix...

You are right. I'm rude. I'm that way for a reason. You choose to use an inaccurate and inappropriate means of solving a problem. Just because it is 'simple' does not mean it is reliable or correct.

One which will accumulate errors over time, thereby requiring frequent intervention to fix. And as far as your "KISS" approach, the best approach to that is to put an alarm clock by the operator desk, and provide a button for him to press when it goes off. Even that would be more accurate and less error prone then a free-running timer.
 
Just to put my 2p worth in.

I have just added all the code for Day Of Week, and then placed this data on my HMI and all in all it took me less than 5 minutes.

I don't think that for even the most basic PLC programmer, that any of this should cause any problems.

Mark
 
Daba,

I used the AOI from the post Bernie pointed to.

I am testing it now and so far from present day up till 2065 I haven't seen it miss any days.

Mark
 
I'm way ahead of you - I restarted my tests, and it's up to March 2140 st the moment.

I'm waiting to see if it does 2400 OK, which will obviously outlive you, stu, and Barney McGrew...
 

Similar Topics

Hello Everyone, I have tried to access the help function from my RSLogix 5000 but everytime I select a function block on the PLC rung and press...
Replies
3
Views
1,222
I’m working with indirect addressing and trying to make an HMI where each Rectangle Object has a tag of “A[0-127]” with a correlating Push Button...
Replies
15
Views
4,142
I have been tasked to upgrade some SquareD PLCs at our plant. I have done several of these upgrades without any issues. However, I have now met my...
Replies
4
Views
2,406
Hi There, When i did FRD instruction in SLC 500 its working, when i try to simulate in RSLogix 5000 same way as i did in SLC 500 which is not...
Replies
14
Views
2,650
fatal error in rslogix 5000 v20 Error 0x80042082 RxE_locale_changed_by_outside- the locale language Settings for RSLogix 5000 was changed
Replies
1
Views
1,954
Back
Top Bottom