CTU

CTU 1:

The CTU function block is an up counter.

If RESET = TRUE, the counter variable CV is initialized with zero. If the CU input has a rising edge from FALSE to TRUE, the counter variable CV is increased by one. If the counter variable CV reaches the value of the counter limit PV, the Q output is set to TRUE.

CTU 2: Inputs

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

Name

Type

Description

CU

BOOL

On a rising edge: count up by one

RESET

BOOL

TRUE: Reset counter variable CV to the value 0

PV

WORD

Counter limit

CTU 3: Outputs

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

Name

Type

Description

Q

BOOL

TRUE if the counter value CV is greater than or equal to the counter limit PV.

CV

WORD

Counter variable (current counter value)

Requirements

Development environment

Target platform

PLC library to include

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard