dave Posted January 24, 2010 Report Posted January 24, 2010 (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 January 24, 2010 by dave
Groo Posted January 24, 2010 Report Posted January 24, 2010 There are two output parameters where you can assign addresses, i.e MW50 or DB10.DBW5 etc. One is in BCD the other will be an integer.
Paul B Posted January 29, 2010 Report Posted January 29, 2010 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.
dave Posted February 3, 2010 Author Report Posted February 3, 2010 Yes, but that's for the S_CU instruction, not for the simpler CU. Thanks though.
dave Posted February 3, 2010 Author Report Posted February 3, 2010 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.
JesperMP Posted February 3, 2010 Report Posted February 3, 2010 Aggreed. Avoid the "C" counters. They are archaic leftovers from S5.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now