Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
CTU¶
Count-up counter. Increments the counter value CV on each rising edge of
CU. Output Q becomes TRUE when CV reaches or exceeds the
preset value PV.
IEC 61131-3 |
Section 2.5.2.3.4 |
Support |
Not yet supported |
Inputs¶
Name |
Type |
Description |
|---|---|---|
|
|
Count-up input (increments on rising edge) |
|
|
Reset input (sets CV to 0) |
|
|
Preset value |
Outputs¶
Name |
Type |
Description |
|---|---|---|
|
|
Counter output (TRUE when CV >= PV) |
|
|
Current counter value |
Behavior¶
On each rising edge of CU, the counter value CV is incremented by one.
When R is TRUE, CV is reset to zero. The output Q is TRUE
when CV is greater than or equal to the preset value PV.
Example¶
VAR
counter1 : CTU;
count_pulse : BOOL;
reset : BOOL;
done : BOOL;
END_VAR
counter1(CU := count_pulse, R := reset, PV := 10);
done := counter1.Q;