Sign in to follow this  
Followers 0
Div_by_zero

delay one scan in P3K

8 posts in this topic

I have a program with a counter in it. Sometimes, I might have to count two different events that can both go high on the same scan. When this happens, the counter only increases by one, not two. I band-aided this by adding a 5 millisecond delay timer to the second event. I am not particularly fond of coding like this. Is there a way to delay the second event going by exactly one scan so that it properly advances the counter? For what it's worth, using P3K. As always, thanks for any help.

Share this post


Link to post
Share on other sites
Use your second event as a NOT then drive a PLS. Use the PLS contact to drive your counter. EDIT: Depending upon your second event timing this may not be what you want. Have your second event drive a PLS 'A' then use PLS 'A' NOT drive PLS 'B'. Use PLS 'B' to drive your counter. Edited by IO_Rack

Share this post


Link to post
Share on other sites
Excuse my ignorance, but what is a PLS? Not sure if P3K has a NOT in it. I assume it must...

Share this post


Link to post
Share on other sites
My appologies. I am the one confused here. I thought you were programming a PLC. I've not worked with the P3K.

Share this post


Link to post
Share on other sites
In case it is helpful, the PLS I'm referring to is a Pulse or 'On for One Scan' instruction used in most AD PLCs. If you can make this happen with the P3K then consider this...

Share this post


Link to post
Share on other sites
Count both events individually then add the accumulated values together. Edited by b_carlton
1 person likes this

Share this post


Link to post
Share on other sites
I was going to suggest that since the scan delays were getting more messy than his timer. :)

Share this post


Link to post
Share on other sites
What I'm going to do (I think this suggestion has actually been implied) is ditch the counter and the baggage associated with it and just use integer math to index my sequencer.

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