Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 149
Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES) Chapter 3
Count Up/Down (CTUD)
The CTUD instruction counts up by one when CUEnable transitions from clear
to set. The instruction counts down by one when CDEnable transitions from
clear to set. This instruction is available in relay ladder as three separate
instructions:
· CTU (See page 141
)
· CTD (See page 145
)
· RES (See page 153
)
Operands:
Structured Text
Function Block
FBD_COUNTER Structure
Variable Type Format Description
CTUD tag FBD_COUNTER Structure CTUD structure
Operand Type Format Description
CTUD tag FBD_COUNTER Structure CTUD structure
Input Parameter Data Type Description
EnableIn BOOL Function Block
If cleared, the instruction does not execute and outputs are not updated.
If set, the instruction executes.
Default is set.
Structured Text
No effect. The instruction executes.
CUEnable BOOL Enable up count. When input toggles from clear to set, accumulator counts up by one.
Default is cleared.
CDEnable BOOL Enable down count. When input toggles from clear to set, accumulator counts down by one.
Default is cleared.
PRE DINT Counter preset value. This is the value the accumulated value must reach before DN is set.
Valid = any integer
Default is 0.
Reset BOOL Request to reset the timer. When set, the counter resets.
Default is cleared.