CTUD_UDINT

CTUD_UDINT

PROGRAM CTUD_UDINT_DEMO
     VAR
     BOOL1,BOOL2,BOOL3,BOOL4,BOOL5,BOOL6: BOOL;
  UDINT1,UDINT2: UDINT;
   FB:CTUD_UDINT;
 END_VAR
    FB(CU:=BOOL1,CD:=BOOL2,R:=BOOL3,LD:=BOOL4,PV:=UDINT1,QU=>BOOL5,QD=>BOOL6,CV=>UDINT2);
END_PROGRAM

The block is an up and down counter. If both r and ld are true, r has higher priority.

InputType Description Default value
CU BOOL Adds 1 on rising edge False
CD BOOL Subtracts 1 on rising edge False
R BOOL Reset to zero False
LD BOOL Sets the counter to the maximum valueFalse
PV UDINTMaximum counter value 0
OutputType Description
QU BOOL Status when the counter reaches its maximum value
QD BOOL Status when the counter is zero
CV UDINTCurrent counter value

  • © Energocentrum Plus, s.r.o. 2017 - 2024