Count Up/Down (CTUD)
CTUD(CTUD_tag);
Input Parameter
Data Type
EnableIn
BOOL
CUEnable
BOOL
CDEnable
BOOL
PRE
DINT
Reset
BOOL
Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES)
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
· CTD (See
· RES (See
Operands:
Structured Text
Variable
CTUD tag
Function Block
Operand
CTUD tag
FBD_COUNTER Structure
Description
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.
Enable up count. When input toggles from clear to set, accumulator counts up by one.
Default is cleared.
Enable down count. When input toggles from clear to set, accumulator counts down by one.
Default is cleared.
Counter preset value. This is the value the accumulated value must reach before DN is set.
Valid = any integer
Default is 0.
Request to reset the timer. When set, the counter resets.
Default is cleared.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
page
141)
page
145)
page
153)
Type
FBD_COUNTER
Type
FBD_COUNTER
Format
Description
Structure
CTUD structure
Format
Description
Structure
CTUD structure
Chapter 3
149