CTU

CTU 1:

The function block CTU is an up counter.

CTU 2: Inputs

VAR_INPUT
    CU    : BOOL; (* Count Up *)
    RESET : BOOL; (* Reset Counter to 0 *)
    PV    : WORD; (* Counter Limit *)
END_VAR

Name

Type

Description

CU

BOOL

Counting up

RESET

BOOL

Reset the counter to 0.

PV

WORD

Counter limit

CTU 3: Outputs

VAR_OUTPUT
    Q  : BOOL; (* Counter reached the Limit *)
    CV : WORD; (* Current Counter Value *)
END_VAR

Name

Type

Description

Q

BOOL

Q returns TRUE if CV is greater than or equal to the upper limit PV.

CV

WORD

If RESET = TRUE, the counter variable CV is initialized with 0. If CU has a rising edge from FALSE to TRUE, then the function block CV is increased by 1 as long as CV is less than PV. (i.e. if no overflow is caused)

Requirements

Development environment

Target platform

PLC library to include

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard