Siemens SIMATIC S7-200 System Manual page 128

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual
Count Up/Down Counter
The Count Up/Down instruction (CTUD) counts up each time the count up (CU) input makes the
transition from off to on, and counts down each time the count down (CD) input makes the
transition from off to on. The current value Cxx of the counter maintains the current count. The
preset value PV is compared to the current value each time the counter instruction is executed.
Upon reaching maximum value (32,767), the next rising edge at the count up input causes the
current count to wrap around to the minimum value (--32,768). On reaching the minimum value
(--32,768), the next rising edge at the count down input causes the current count to wrap around
to the maximum value (32,767).
When the current value Cxx is greater than or equal to the preset value PV, the counter bit Cxx
turns on. Otherwise, the counter bit turns off. The counter is reset when the Reset (R) input turns
on, or when the Reset instruction is executed.
STL operation:
H Reset input: Top of stack
H Count Down input: Value loaded in the second stack location
H Count Up input: Value loaded in the third stack location
Table 6-22
Valid Operands for the SIMATIC Counter Instructions
Inputs/Outputs
Cxx
CU, CD, LD, R
PV
Tip
Since there is one current value for each counter, do not assign the same number to more than
one counter. (Up Counters, Up/Down Counters, and Down counters with the same number
access the same current value.)
When you reset a counter using the Reset instruction, the counter bit is reset and the counter
current value is set to zero. Use the counter number to reference both the current value and the
counter bit of that counter.
Table 6-23
Operations of the Counter Instructions
Type
Operation
CTU
CU increments the current
value.
Current value continues to
increment until it reaches
32,767.
CTUD
CU increments the current
value.
CD decrements the current
value.
Current value continues to
increment or decrement until
the counter is reset.
CTD
CD decrements the current
value until the current value
reaches 0.
1
You can select that the current value for the counter be retentive. See Chapter 4 for information about memory
retention for the S7-200 CPU.
114
Data Types
Operands
WORD
Constant (C0 to C255)
BOOL
I, Q, V, M, SM, S, T, C, L, Power Flow
INT
IW, QW, VW, MW, SMW, SW, LW, T, C, AC, AIW, *VD, *LD, *AC,
Constant
Counter Bit
The counter bit turns on when:
Current value >= Preset
The counter bit turns on when:
Current value >= Preset
The counter bit turns on when:
Current value = 0
Power Cycle/First Scan
Counter bit is off.
Current value can be retained.
Counter bit is off.
Current value can be retained.
Counter bit is off.
Current value can be retained.
1
1
1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents