Table of Contents

CTU

Block name

CTU

ST call

PROGRAM CTU_DEMO
    VAR
     BOOL1,BOOL2,BOOL3: BOOL;
    INT1,INT2: INT;
     FB:CTU;
    END_VAR
    FB(CU:=BOOL1,R:=BOOL2,PV:=INT1,Q=>BOOL3,CV=>INT2);
END_PROGRAM

Description

The block acts as a counter counting up from zero to the preset value pv.

Inputs

InputTypeDescription Default value
CD BOOLRising edge counts one up False
R BOOLSets the counter to zeroFalse
PV INT Final value of the counter 0

Outputs

OutputTypeDescription
Q BOOLState when the counter finished counting (counting finished: q=true).
CV INT Current value of the counter

Application example