Jump to content

Recommended Posts

Posted (edited)
Hello all - using Step7 (300 series), I have some simple counters like C1, C2, etc. programmed as CU instructions for counting up and using SC instruction to load their preset values. They work perfectly fine. Question: How can I get at the counter current values for use elsewhere in my logic? For example, if I want to check if C3 is greater than 2, for example, I try to use a CMP >I instruction but it rejects C3 as it isnt a defined integer. Likewise is there a way to get at the preset values too? Edited by dave

Posted
I'm late but what the hey. It is for this reason I write my own counter instruction in an FC with input & output parameters. The instruction is very simple and uses integer addresses. I'm sure you can picture it in your head... When input turns on, add a 1 to accumulated as long as accumulated is less than preset. Next rung compares accumulated to preset and if GE, turns on done output. Last rung resets the accumulated when reset input turns on.
Posted
Thanks Paul. That's exactly what I've done in the end. I was hoping to avoid it as I had so many CU instructions but once the FC was configured not a major deal. I actually created a multipurpose CU/CD counter with preset/reset inputs and actual/preset values as DINT so it doesn't suffer from any of the limitations of the S7 counters.

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
×
×
  • Create New...