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

CU

BOOL

Count-up input (increments on rising edge)

R

BOOL

Reset input (sets CV to 0)

PV

INT

Preset value

Outputs

Name

Type

Description

Q

BOOL

Counter output (TRUE when CV >= PV)

CV

INT

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;

See Also

  • CTD — count-down counter

  • CTUD — count up/down counter