FUNCTION_BLOCK E_CTUD

Hover on a highlighted element
to see its description.

ECC
ALGORITHM CU IN ST : (* Count Up *)
  CV := CV + 1;
  Q := (CV >= PV);
  Q0 := FALSE;
END_ALGORITHM
ALGORITHM CD IN ST : (* Count Down *)
  CV := CV - 1;
  Q0 := (CV = 0);
  Q := (CV >= PV);
END_ALGORITHM
ALGORITHM R IN ST : (* Reset *)
  CV := 0;
  Q := FALSE;
  Q0 := TRUE;
END_ALGORITHM

An instance of this Function Block type implements an event-driven up/down counter. Its operation is defined by the Execution Control Chart (ECC) and algorithms shown above.