Back to FBD reference

Counters

CTUD

Up/down counter

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

NameTypeRequiredDescription
PULSEBOOLYesCount input. Rising edges are counted.
DIRBOOLYesCount direction: FALSE up, TRUE down.
RBOOLYesReset to PV and reset Q.

Outputs

NameTypeRequiredDescription
QBOOLYesOutput controlled by count value and ON/OFF thresholds.

Parameters

NameTypeRequiredDefaultDescription
PVnumberNo0Initial value and reset target.
ONnumberNo0Q turn-on threshold.
OFFnumberNo0Q 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.

Related blocks