Counter instructions
320
Part II IEC Instructions
CTUD
Up/down counter
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
For CTUD declare the following:
CU count up
the value 1 is added to the current CV for each rising edge detected at CU,
except when RESET and/or LOAD is/are set.
CD count down
the value 1 is subtracted from the current CV for each rising edge detected at
CD, except when RESET and/or LOAD is/are set and if CU and CD are
simultaneously set. In the latter case, counting will be upwards.
RESET (R) reset
if RESET is set, CV will be reset
LOAD (LD) Set
if LOAD is set, PV is loaded to CV. This, however, does not apply if RESET is
set simultaneously. In this case, LOAD will be ignored.
PV preset value
defines the preset value which is to be attained with the addition or subtraction
(PV = preset value)
QU signal output - count up
is set if CV is greater than/equal to PV
QD signal output - count down
is set if CV = zero
CV current value
is the addition/subtraction result (CV = current value)
The names in brackets are the valid parameter names of the ST-editor.
PLC types Availability of CTUD (see page 1319)
Description
The function block CTUD (count up/down) allows you to program counting procedures (up and
down).