The CTUD block uses one PULSE input, a DIR direction input, and R reset. ON and OFF parameters define Q switching thresholds.
Typical FBD symbol
PULSE
DIR
R
CTUD
Q
Typical FBD symbol for CTUD
Inputs
Name
Type
Required
Description
PULSE
BOOL
Yes
Count input. Rising edges are counted.
DIR
BOOL
Yes
Count direction: FALSE up, TRUE down.
R
BOOL
Yes
Reset to PV and reset Q.
Outputs
Name
Type
Required
Description
Q
BOOL
Yes
Output controlled by count value and ON/OFF thresholds.
Parameters
Name
Type
Required
Default
Description
PV
number
No
0
Initial value and reset target.
ON
number
No
0
Q turn-on threshold.
OFF
number
No
0
Q turn-off threshold.
Stateful
Yes, the block keeps internal state between scans.
Behavior rule
On a PULSE edge, counts up when DIR = FALSE and down when DIR = TRUE; R returns the counter to PV and resets Q; ON and OFF define turn-on and turn-off thresholds.
Practical use
monitoring a buffer, accumulator, or part count with arrivals and departures.
What to watch
Misreading DIR direction: FALSE counts up, TRUE counts down.