Table of Contents

CTU_UDINT

Block name

CTU_UDINT

ST call

PROGRAM CTU_UDINT_DEMO
  VAR
     BOOL1,BOOL2,BOOL3: BOOL;
    UDINT1,UDINT2: UDINT;
   FB:CTU;
    END_VAR
    FB(CU:=BOOL1,LD:=BOOL2,PV:=UDINT1,Q=>BOOL3,CV=>UDINT2);
END_PROGRAM

Description

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

Inputs

InputType Description Default value
CU BOOL Rising edge counts one up False
R BOOL Sets the counter to zeroFalse
PV UDINTFinal value of the counter 0

Outputs

OutputType Description
Q BOOL State when the counter finished counting (counting finished: q=true).
CV UDINTCurrent value of the counter

Application example