CTUD_DINT

CTUD_DINT

PROGRAM CTUD_DINT_DEMO
  VAR
     BOOL1,BOOL2,BOOL3,BOOL4,BOOL5,BOOL6: BOOL;
  DINT1,DINT2: DINT;
  FB:CTUD_DINT;
  END_VAR
    FB(CU:=BOOL1,CD:=BOOL2,R:=BOOL3,LD:=BOOL4,PV:=DINT1,QU=>BOOL5,QD=>BOOL6,CV=>DINT2);
END_PROGRAM

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

InputTypeDescription Default value
CU BOOLAdds 1 on rising edge False
CD BOOLSubtracts 1 on rising edge False
R BOOLReset to zero False
LD BOOLSets the counter to the maximum valueFalse
PV DINTMaximum counter value 0
OutputTypeDescription
QU BOOLStatus when the counter reaches its maximum value
QD BOOLStatus when the counter is zero
CV DINTCurrent counter value

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