Sign in to follow this  
Followers 0
rwraley

S:40 status bit

12 posts in this topic

Hi all, I am trying to reset a counter (CTU) in SLC 5/03 program. I would like to reset it at midnight every night. I thought I might be able to use the S:40 status bit as source A in a EQU instruction and have source B be 12:00am so when the EQU was true I could energize a (RES) bit. When I insert S:40 into the EQU instruction I get an error that: Address S:40 exceeds size of data table by 8 elements. The first question is, am I even on the right track with this? The second question is, can I adjust the data table to accomodate this instruction? Also does S:40 register as a 24 hour clock or military time or simply 1 through 24? Any and all help is much appreciated.

Share this post


Link to post
Share on other sites
You are on the right lines, however S:40 is just the hour (eg 0 to 23). The compare needs to be S:40 EQU 0 You will also need a OSR in series with the counter reset so that the reset only occurs when the hour first goes to zero. In fact I would go slightly further and use this logic. Edited by Snerkel

Share this post


Link to post
Share on other sites
This logic will reset counter C5:5 at midnight: EQU S:42 0 OSR B3:9/0 EQU S:41 0 EQU S:40 0 RES C5:5 Change the OSR address to a free bit address and change the counter address to match your program. Yes, the hour is in military time (00:00:00 equals midnight to 23:59:59) Edited by OkiePC

Share this post


Link to post
Share on other sites
And be aware that the counter will immediately count 1 after reset if the counting condition is On.

Share this post


Link to post
Share on other sites
Greetings rwraley, here’s my best guess ... you actually have an SLC-5/02 processor (or lower) ... and NOT an SLC-5/03 as you posted ... the addresses in the Status File for an SLC-5/02 only go up to S:32 ... when you enter the address “S:40” in an SLC-5/02 program, the compiler does indeed give you exactly the error message that you reported: “Address S:40 exceeds size of data table by 8 elements(s)” ... so ... are you sure that you actually do have an SLC-5/03? ... if you do, then you MIGHT just be working on an offline file which was specified as being for an SLC-5/02 (or lower) ... you might have made this mistake when you did the setup under “File/New” ... so ... if you have LESS THAN an SLC-5/03, then I’m afraid that “you can’t get there from here” ... basic idea: the smaller processors don’t have a built in realtime clock ... if you do have an SLC-5/03 (or higher) then the excellent advice that the other posters have given you should help you get things working ... and incidentally ... this is picky but you referred to S:40 as a “status bit” ... actually it is not a “bit” ... it is a “word” composed of 16 bits ... this slight mistake is NOT causing your problem ... but knowing the difference between “bits” and “words” might be helpful when error messages such as: “Address must be specified to the word level” pop up in the future ... secret handshake: in Allen-Bradley PLC and SLC addresses, the “/” slash character means “we’re talking about a bit” ... PS edit ... just in case you DO have an SLC-5/03, please post again and give us ALL of the specifications on it including the Operating System, Series, and Firmware Revision numbers ... example: OS300, Series A, FRN 1.00 ... personally, I'm not aware of ANY SLC-5/03s which did not have a realtime clock ... but it's conceivable that you MIGHT have a very old model that I've never run into before ... hope this helps ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
We used to have this problem a lot. Instead of reseting the counter we move 0 to the accumulated value. It drops the done bit just like the reset but does not increment the counter if the rung condition is true. We have never seen any problem with doing it this way but has anyone else tried it? What is the difference between reseting a counter and moving a zero to the accumulated value?

Share this post


Link to post
Share on other sites
the RES drives the Accumulator to zero ... and ... it also writes zeros to the status bits (CU, CD, DN) ... this "resetting" of the status bits explains why you were getting the "false" count when using the RES ... specifically, the next time the processor scans the rung and finds the rung TRUE, it checks the CU bit to see "have I already counted this?" ... since the CU bit was OFF (by way of the RES action) then the processor assumes that the TRUE condition of the rung has not yet been counted ... and it adds one to the Accumulator ... the "MOV of zero" solution for the counter's Accumulator does not "destroy" the "been-there-done-that" information that is stored in the counter's CU bit ... some programmers use a CLR (Clear) instruction rather than an MOV ... you'll get the same results with either method ... I've also seen other programmers who stick with the RES instruction (possibly because the technicians understand it better) and then put an OSR (One Shot) after the "count this" input ... in most cases, this will also solve the "false count" problem caused by a "count this" input which stays on during a counter reset ... it looks kind of "fishy" to see an OSR in front of a counter ... but once you understand why it's there, it does make sense ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
Ron, You are correct. I am working with a 5/02. I was working the last couple of days with 5/03 and I guess I still had it on my brain when I posted. All of these posts are still helpfull and I'm always amazed at the knowledge that is contained in your posts. since "I can't get there from hereI will have to rethink the reset with the 5/02, I do have a panel view 550 communicating with processor that does contain time clock. I will look into reseting from there. Edited by rwraley

Share this post


Link to post
Share on other sites
Since you have a Panelview just setup tags Year,Month,Day,Hour, and Minute to point to a data table and in Panelbuilder go to Application Setting, Status Tags and put you tags into the corresponding cells. I have never found a reason to configure the seconds since the Panelview time only updates in 1 minute increments at the lowest This assumes you have a Standard Panelview and not a Panelview Plus. It can be done with the Panelview plus too but can't remember how Actually is there a Panelview Plus 550? Edited by TWControls

Share this post


Link to post
Share on other sites
OK, I think I have it. I moved the acc value of C5:1 (cycles per day) to N7:3 so the panel view can read and display. Then I set the status tags in PV for the hour tag to = N7:0 and the minute tag to =N7:1. When N7:0 equals 0 and N7:1 equals 0 the rung will be true and RES C5:1 will go high. Cummulative cycle counter C5:0 triggers from same bit as C5:1 but has no reset so will count total cycles (to 1mil) then I moved the acc value to N7:2 to be read and displayed on screen. I'm not at work today so I'll have to wait to download to both PV and SLC to see just how srewed up I am.

Share this post


Link to post
Share on other sites
Your are correct except you talk about a "lifetime" cycle counter counting to 1mil (I assume 1 million). I think the maximum the SLC 500 can count to is 32767

Share this post


Link to post
Share on other sites
32767 is close enough. The tags in PV wanted a max value so I threw in 1m figuring it would never reach it. If need be I 'll write a couple of lines to add the max value when reached to subsequent value to maintain count. Thanks for all your help!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0