0% found this document useful (0 votes)
84 views12 pages

S7 Counter Instructions

This document discusses different types of counters used in programmable logic controllers, including up counters, down counters, and up-down counters. It explains how counters work and are represented in memory, how to set and increment/decrement counter values using ladder logic instructions, and factors to consider when selecting a counter for an application. Specific instructions for up counters, down counters, and up-down counters are described, along with examples of ladder logic using counters.

Uploaded by

NabilBouabana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views12 pages

S7 Counter Instructions

This document discusses different types of counters used in programmable logic controllers, including up counters, down counters, and up-down counters. It explains how counters work and are represented in memory, how to set and increment/decrement counter values using ladder logic instructions, and factors to consider when selecting a counter for an application. Specific instructions for up counters, down counters, and up-down counters are described, along with examples of ladder logic using counters.

Uploaded by

NabilBouabana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Tricom Controls

Define counter types, how it works and


how to select the optimum counter for your
application.

8. COUNTER INSTRUCTIONS

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
127
Tricom Controls
Counters have an area reserved for them in the memory of your CPU. This memory area reserves
one 16-bit word for each counter address. The ladder logic instruction set supports 256 counters.

The counter instructions are the only functions that have access to the counter memory area.
Count Value
Bits 0 through 9 of the counter word contain the count value in binary code.

The count value is moved to the counter word when a counter is set. The range of the count value
is 0 to 999.

You can vary the count value within this range by using the following counter instructions:

• S_CUD Up-Down Counter

• S_CD Down Counter

• S_CU Up Counter

• --- (SC) Set Counter Coil

• --- (CU) Up Counter Coil

• --- (CD) Down Counter Coil

Bit Configuration in the Counter

You provide a counter with a preset value by entering a number from 0 to 999, for example 127,
in the following format: C#127. The C# stands for binary coded decimal format (BCD format:
each set of four bits contains the binary code for one decimal value).
Bits 0 through 11 of the counter contain the count value in binary coded decimal format.
The following figure shows the contents of the counter after you have loaded the count value 127
and the contents of the counter cell after the counter has been set.

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
128
Tricom Controls
S_CU Up Counter

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
129
Tricom Controls
Description

S_CU (Up Counter) is preset with the value at input PV if there is a positive edge at input S.
The counter is reset if there is a "1" at input R and the count value is then set to zero.

The counter is incremented by one if the signal state at input CU changes from "0" to "1" and the
value of the counter is less than "999".

If the counter is set and if RLO = 1 at the inputs CU, the counter will count accordingly in the
next scan cycle, even if there was no change from a positive to a negative edge or vice versa.

The signal state at output Q is "1" if the count is greater than zero and "0" if the
count is equal to zero.

If I0.2 changes from "0" to "1", the counter is preset with the value of MW10. If the signal state
of I0.0 changes from "0" to "1", the value of counter C10 will be incremented by one - unless the
value of C10 is equal to "999". Q4.0 is "1" if C10 is not equal to zero.

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
130
Tricom Controls
S_CD Down Counter

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
131
Tricom Controls
Description
S_CD (Down Counter) is set with the value at input PV if there is a positive edge at input S.

The counter is reset if there is a 1 at input R and the count value is then set to zero.

The counter is decremented by one if the signal state at input CD changes from "0" to "1" and the
value of the counter is greater than zero.

If the counter is set and if RLO = 1 at the inputs CD, the counter will count accordingly in the
next scan cycle, even if there was no change from a positive to a negative edge or vice versa.
The signal state at output Q is "1" if the count is greater than zero and "0" if the count is equal to
zero.

If I0.2 changes from "0" to "1", the counter is preset with the value of MW10. If the signal state
of I0.0 changes from "0" to "1", the value of counter C10 will be decremented by one - unless the
value of C10 is equal to "0". Q4.0 is "1" if C10 is not equal to zero.

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
132
Tricom Controls

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
133
Tricom Controls
Description

S_CUD (Up-Down Counter) is preset with the value at input PV if there is a positive edge at
input S. If there is a 1 at input R, the counter is reset and the count is set to zero. The counter is
incremented by one if the signal state at input CU 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 input
CD and the value of the counter is greater than "0".

If there is a positive edge at both count inputs, both instructions are executed and the count value
remains unchanged.

If the counter is set and if RLO = 1 at the inputs CU/CD, the counter will count accordingly in
the next scan cycle, even if there was no change from a positive to a negative edge or vice versa.

The signal state at output Q is "1" if the count is greater than zero and "0" if the count is equal to
zero.

Example:

If I0.3 changes from "0" to "1", the counter is preset with the value of 20.

If the signal state of I0.4 changes from "0" to "1", the value of counter C10 will be incremented
by one - except when the value of C10 is equal than "999".

If I0.5 changes from "0" to "1", C10 is decremented by one - except when the value of C10 is
equal to "0". Q8.3 is "1" if C10 is not equal to zero.

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
134
Tricom Controls

--- (SC) Set Counter Value

Description

--- (SC) (Set Counter Value) executes only if there is a positive edge in RLO. At that time, the
preset value transferred into the specified counter.

The counter C5 is preset with the value of 100 if there is a positive edge at input I0.0 (change
from "0" to "1"). If there is no positive edge, the value of counter C5 remains unchanged.

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
135
Tricom Controls
--- (CU) Up Counter Coil
Description

--- (CU) (Up Counter Coil) increments the value of the specified counter by one if there is a
positive edge in the RLO and the value of the counter is less than "999". If there is no positive
edge in the RLO or the counter already has the value "999", the value of the counter will be
unchanged.

If the signal state of input I0.0 changes from "0" to "1" (positive edge in RLO), the preset value
of 100 is loaded to counter C10.

If the signal state of input I0.1 changes from "0" to "1" (positive edge in RLO), counter C10
count value will be incremented by one unless the value of C10 is equal to "999". If there is no
positive edge in RLO, the value of C10 will be unchanged. If the signal state of I0.2 is "1", the
counter C10 is reset to "0".

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
136
Tricom Controls
--- (CD) Down Counter Coil

Description

--- (CD) (Down Counter Coil) decrements the value of the specified counter by one, if there is a
positive edge in the RLO state and the value of the counter is more than "0". If there is no
positive edge in the RLO or the counter has already the value "0", the value of the counter will be
unchanged.

If the signal state of input I0.0 changes from "0" to "1" (positive edge in RLO), the preset value
of 100 is loaded to counter C10.

If the signal state of input I0.1 changes from "0" to "1" (positive edge in RLO), counter C10
count value will be decremented by one unless the value of C10 is equal to "0". If there is no
positive edge in RLO, the value of C10 will be unchanged.
If the count value = 0, then Q4.0 is turned on.
If the signal state of input I0.2 is "1", the counter C10 is reset to "0".

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
137
Tricom Controls

Comments:

----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------- -------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--------------------- ------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
---------- -----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--------------------------------

Tricom Controls S.A.E ‫ام


 ا‬
20 Street 295, New Maadi, Cairo - Postal Code 11435 - Tel: 002 02/25181138, Fax: 002 02/25181137
Email: info@tricomcontrols.com
٠٠٢ ٠٢/٢٥١٨١١٣٧ :‫ ف‬٠٠٢ ٠٢/٢٥١٨١١٣٨ :‫ ت‬- ١١٤٣٥ ‫ ر ى‬- ‫ ا دى اة‬- ٢٩٥ ‫ رع‬٢٠
138

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy