Table of Contents

CTU_DINT

Block name

CTU_DINT

ST call

PROGRAM CTU_DINT_DEMO
   VAR
     BOOL1,BOOL2,BOOL3: BOOL;
    DINT1,DINT2: DINT;
  FB:CTU;
    END_VAR
    FB(CU:=BOOL1,R:=BOOL2,PV:=DINT1,Q=>BOOL3,CV=>DINT2);
END_PROGRAM

Description

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

Inputs

InputTypeDescription Default value
CU BOOLRising edge counts one up False
R BOOLSets the counter to zeroFalse
PV DINTFinal value of the counter 0

Outputs

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

Application example