Documentation
Counters

Counter Functions in Ladder Diagram

Counters are used to count occurrences of events. They come in three primary types: CTU (Count Up), CTD (Count Down), and CTUD (Count Up Down), each serving different purposes within a control system.

Symbols

<???>
CTU
CU
Q
R
PV
CV
<???>
CTD
CD
Q
LD
PV
CV
<???>
CTUD
CU
QU
CD
R
LD
PV
QD
CV

Configuration

Counters in Ladder Logic require input parameters for counting up (CU), counting down (CD), and resetting (R). The output parameters include Preset Value (PV), Current Value (CV), Output (Q), Output Up (QU), and Output Down (QD).

The CU and CD inputs increment or decrement the CV, respectively, whenever they transition from false to true. The R input resets the CV to zero when it transitions from false to true.

Counter variable

Runtime Behavior

The Counter function is executed in every cycle scan as long as the CU, CD, or R inputs are true. The CV is compared to the PV in each cycle, and the Q, QU, or QD outputs are set accordingly based on whether CV is equal to or greater than PV, or whether it's counting up or down.

CU (Count Up)

CounterVariable
CTU
CU
Q
R
false
PV
8
CV
5

CTD (Count Down)

CounterVariable
CTD
CD
QD
LD
false
PV
8
CV
5

CTUD (Count Up Down)

CounterVariable
CTUD
CU
QU
CD
false
R
false
LD
false
PV
8
QD
false
CV
3

Examples


© CodingPLC 2024