CTU

CTU 1:

Incrementer

VAR_INPUT

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

VAR_OUTPUT

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

The counter variable CV will be initialized with 0 if RESET is TRUE. If CU has a rising edge from FALSE to TRUE, the function block CV will be raised by 1 provided CV is smaller than PV (i.e., it doesn't cause an overflow). Q will return TRUE when CV is greater than or equal to the upper limit PV.

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard