5-8
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
5.5
Counter Instructions
The Up/Down Counter counts up each time the count-up input transitions from off to on, and
counts down each time the count-down input transitions from off to on. The counter resets
when the reset input turns on. Upon reaching maximum value (32,767), the next rising edge
at the count-up input will cause the current count to wrap around to the minimum value
(-32,768). Likewise on reaching the minimum value (-32,768), the next rising edge at the
count-down input will cause the current count to wrap around to the maximum value
(32,767).
The Up/Down counter has a current value that maintains the current count. Use the counter
number to reference the current value. Since there is one current value for each counter, do
not assign the same number to more than one counter.
Up/Down Counter
The Up/Down Counter instruction counts up on rising edges of
the Count Up (CU) input. It counts down on the rising edges of
the Count Down (CD) input. The counter resets when the Reset
(R) input turns on
In STL, the Reset input is the top of the stack value, the Count
Down input is the value loaded in the second stack location,
and the Count Up input is the value loaded in the third stack
location.
Operands:
Cx:
C0 to C3
PV:
0 (preset value is not used)
Counter Example
I0.3
Up
Network
LD
I0.3
//Count Up Clock
LD
I0.2
//Count Down Clock
LD
I0.1
//Reset
CTUD
C1, 0
Network
LDW>=
C1, 4
=
Q0.2
Timing Diagram
LAD
STL
I0.2
Down
I0.3
I0.2
0
I0.1
I0.1
Reset
0
1
2
3
4
5
4
3
4
5
C1
Current
Q0.2
Q0.2
C1
>=I
+4
C1
CTUD
CU
R
PV
CD
Figure 5-5
Example of the Counter Instruction
Instruction Set
L
A
D
S
T
L
CTUD
Cx, PV
Cx
CTUD
CU
R
PV
CD
Summary of Contents for Simatic S7-200 CPU 210
Page 10: ...x S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Contents ...
Page 116: ...A 16 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Data Sheets ...
Page 126: ...F 2 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Order Numbers ...
Page 138: ...Index 12 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Index ...