Sign in to follow this  
Followers 0
BadgerGuy

Problem Restting The Counters In A Micrologix 1200

11 posts in this topic

I added a reset to four of my counters but when I press reset, the counter resets to 1 and not 0 how can I get the counter to reset to zero? Thanks

Share this post


Link to post
Share on other sites
Use the cross-reference feature to find any and all pieces of logic that deal with that counter. Some other code is strobing it to count. If need be, post your program here and someone will be able to point it out. Edited by jstolaruk

Share this post


Link to post
Share on other sites
Check to make sure your counter presets are at 0 and not at 1.

Share this post


Link to post
Share on other sites
smart money says that this post will help ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
If you reset a counter with the RST and the counter rung is true, it will immediately upcount the next scan. Be sure to see Ron's excellent explanation that he linked to to understand why this is the case. The quick and dirty solution is to go ahead and program a oneshot on the counter rung. Or you could structure your logic to avoid the situation.

Share this post


Link to post
Share on other sites
Or you can move a zero to the ACC instead of doing the reset. The counter will not increment if enabled

Share this post


Link to post
Share on other sites
If I move a "0" to the acc, the bits(DN,EN. etc.) change state?

Share this post


Link to post
Share on other sites
The CU bit will not go to zero like it will with a RES instruction According to Ron Beaufort in a previous post Edited by TWControls

Share this post


Link to post
Share on other sites
I understant the rung is infact true in start up. Could I make the counters value -1 at first? thanks

Share this post


Link to post
Share on other sites
If the rung is true the ACC will be 1 on a RES and 0 on a MOV 0 to ACC

Share this post


Link to post
Share on other sites
I believe that the pre-scan sets the counter CU bit when the program first runs at startup. This is supposed to keep an upcount from occuring if the rung is true on the first scan. If I'm wrong and the prescan is not setting the CU bit then you can specifically set it using the S:1/15 first pass bit just before you execute the CTU instruction. This will prevent the upcount and if the CTU rung is false then the CU bit will be automatically reset so everyting will be ready on the second scan. This is a superior solution because if the rung is ever not true on the first scan then you are stuck with a -1 in the ACC. Don't be afraid to manipulate the CU bit in your ladder. Understanding it and manipulating it when required can significantly increase the usefullness of counters in many applications. For example you can build self-aligning sequencers and for-next loops with counters by manipulating the CU bit. Edited by Alaric

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