Sign in to follow this  
Followers 0
Div_by_zero

Control Logix "scan complete" bit

6 posts in this topic

Still having some trouble finding all the "Status" bits in RS Logix 5000. I know that "S:FS" is the first scan bit. Is there a "scan complete bit"? I want to have a counter that increments up one time at the end of each scan. I assume there is some way to do this? Thanks.

Share this post


Link to post
Share on other sites
If you want to count scans of a routine, use an unconditional ADD instruction that adds 1 to a DINT type tag. Every time the routine executes, the DINT value will increase by 1. You'll have to reset the value to zero eventually, of course. I use this method frequently when I'm trying to determine if a particular routine is being called by a JSR, or by an interrupt.

Share this post


Link to post
Share on other sites
Thanks, Ken. Question: what do you mean by "unconditional"? If I put an ADD instruction in a rung with my always_on bit firing it, I think tat will just result in 1 and that's it, right?

Share this post


Link to post
Share on other sites
The ADD instruction will 'add 1' on each scan. The resultant number will increase very quickly.Just try it. Edited by b_carlton

Share this post


Link to post
Share on other sites
Thanks. Part of my problem is that I do not have a bench-top 1756 to play with, I have do do everything "blind" at the shop, it the gets taken into the field 3 hours away by someone else. A challenge to program without a test unit!

Share this post


Link to post
Share on other sites
Some instructions, like Counters or MSG instructions, are edge-triggered. The preceding rung conditions have to go from False to True in order to make the instruction execute. Math instructions execute every time the rung is scanned and the preceding conditions are true. If you put nothing but an ADD instruction on a rung (no pre-condition instructions at all) you'll see it execute every single scan. Be sure to use a DINT as the tag with that instruction; using a Float will result in unpredictable behavior once the value gets large relative to 1 (about 2^24) because of the way IEEE 754 encoding works. With an Integer tag, adding 1 always adds 1.

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