Professional Documents
Culture Documents
Note
The application examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The application examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible in ensuring that the described products are correctly used. These application examples do not relieve you of the responsibility in safely and professionally using, installing, operating and servicing equipment. When using these application examples, you recognize that Siemens cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these application examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications - e.g. Catalogs - then the contents of the other documents have priority.
V1.0
2006/05/08
2/6
Table of Content
Table of Content ........................................................................................................... 3 Counters and Accumulators........................................................................................ 4 1 2 3 4 5 Summary of Counter Operation (FC27) Functions:..................................... 4 Summary of Accumulator Operation (FC38) Functions:............................. 4 Modifying Your Application for Other Counter Types................................. 5 Modifying Your Application for Other Comparator Types .......................... 6 Modifying Your Application for Other Mathematical Instructions ............. 6
Reference to Automation and Drives Service & Support This entry is from the internet application portal of Automation and Drives Service & Support. The documentation has the entry ID 23330722. Click the link below to directly display the download page of this document. http://support.automation.siemens.com/WW/view/en/23330722 All entries referenced in this document are designated by their entry ID and addressed via the above path.
V1.0
2006/05/08
3/6
If the signal state of I0.2 changes from "0" to "1", the value of counter C1 will be incremented by one - unless the value of counter C1 is equal to "999". The counter is reset if there is a "1" at I0.1 and Q0.4; the count value is then set to zero. Q0.5 is "1" if counter C1 is not equal to zero. 2. Network 2: Counter Reset Using an Integer CMP (Compare) GE_I Box: Since the CMP box is always powered as used in this application, IN1 and IN2 are constantly being compared. If MW8 is greater than or equal to the constant value of 20, output Q0.4 is set to 1 for one scan cycle. In the next scan cycle, Q0.4 resets the counter C1 (in Network 1), the MW8 count value goes to "0", and Q0.4 is turned off.
M2.0 (P) (positive edge instruction): When the signal state at M2.0 changes from "0" to "1", the instruction returns a signal state of "1" at the ADD_I box for one scan cycle. The edge memory bit M2.0 saves the old signal state, acting like a "one-shot."
V1.0
2006/05/08
4/6
Counters and Accumulators Modifying Your Application for Other Counter Types
Counters and Accumulators
2. Network 2: Compare Accumulator Value to Setpoint Value with a CMP >=I Box: Since the CMP box is always powered as used in this application, IN1 and IN2 are constantly being compared. If MW14 is greater than or equal to the constant value of 20, output Q0.7 is set to 1. 3. Network 3: MOVE Box to Zero Out the Accumulator Value: When Q0.7 is powered, the contents of IN are moved to MW14. As a result, a "0" value is loaded into MW14, which resets the accumulator (in Network 1) to "0".
3
Copyright Siemens AG 2006 All rights reserved 23330722_Counters_and_Accumulators.doc
The counting range for all three counters is 0 to 999. Count values are entered in the C# data format (for example, C#25).
Table 3-1 Behavior of the Five Timer Types
Description The counter is incremented by one if the signal state at the input changes from "0" to "1" and the value of the counter is less than "999". The counter is decremented by one if there is a positive edge at the input and the value of the counter is greater than "0". The counter is incremented by one if the signal state at the input changes from "0" to "1" and the value of the counter is less than "999" The counter is decremented by one if the signal state at the input changes from "0" to "1" and the value of the counter is greater than zero.
S_CU Up Counter
V1.0
2006/05/08
5/6
Counters and Accumulators Modifying Your Application for Other Comparator Types
Counters and Accumulators
Integers, double integers, and real numbers may be compared. IN1 and IN2 are compared according to the type of comparison you choose.
The mathematical operation that you choose acts upon Input 1 (IN1) and Input 2 (IN2).
V1.0
2006/05/08
6/6