Counter Operations - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Basic instructions

7.3 Counter operations

7.3
Counter operations
Table 7- 23
Counter instructions
LAD / FBD
SCL
"IEC_Counter_0_DB".CTU
(
"IEC_Counter_0_DB".CTD
(
"IEC_Counter_0_DB".CTU
D(
For LAD and FBD: Select the count value data type from the drop-down list below the instruction name.
1
STEP 7 automatically creates the DB when you insert the instruction.
2
In the SCL examples, "IEC_Counter_0_DB" is the name of the instance DB.
3
Table 7- 24
Data types for the parameters
Parameter
CU, CD
R (CTU, CTUD)
LD (CTD, CTUD)
PV
Q, QU
QD
CV
The numerical range of count values depends on the data type you select. If the count value is an unsigned integer
1
type, you can count down to zero or count up to the range limit. If the count value is a signed integer, you can count
down to the negative integer limit and count up to the positive integer limit.
220
CU:=_bool_in,
R:=_bool_in,
PV:=_int_in,
Q=>_bool_out,
CV=>_int_out);
CD:=_bool_in,
LD:=_bool_in,
PV:=_int_in,
Q=>_bool_out,
CV=>_int_out);
CU:=_bool_in,
CD:=_bool_in,
R:=_bool_in,
LD:=_bool_in,
PV:=_int_in,
QU=>_bool_out,
QD=>_bool_out,
CV=>_int_out);
Data type
1
Bool
Bool
Bool
SInt, Int, DInt, USInt, UInt, UDInt
Bool
Bool
SInt, Int, DInt, USInt, UInt, UDInt
Description
Use the counter instructions to count internal program events and
external process events. Each counter uses a structure stored in a
data block to maintain counter data. You assign the data block when
the counter instruction is placed in the editor.
CTU is a count-up counter
CTD is a count-down counter
CTUD is a count-up-and-down counter
Description
Count up or count down, by one count
Reset count value to zero
Load control for preset value
Preset count value
True if CV >= PV
True if CV <= 0
Current count value
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents