CTUD

Counts (integers) from 0 up to a given value in increments of 1 or from a given value down to 0 in increments of 1.
IMPORTANT: The CTUD block does not detect the rising edges and falling edges of the counting inputs (CU and CD). The block must be associated with an R_TRIG or F_TRIG block to create a pulse counter.
lrsb_ctud1
Arguments
CU
BOOL
Up-counting (when CU is TRUE)
CD
BOOL
Down-counting (when CD is TRUE)
RESET
BOOL
Reset command (dominant)
(CV = 0 when RESET is TRUE)
LOAD
BOOL
Load command (CV = PV when LOAD is TRUE)
PV
DINT
Programmed maximum value
QU
BOOL
Overflow: TRUE when CV >= PV
QD
BOOL
Underflow: TRUE when CV <= 0
CV
DINT
Counter result
Example
(* FBD program using the CTUD block *)
lrsb_ctud2
(* ST Equivalence: We suppose R_TRIG1 and R_TRIG2 are two instances of R_TRIG block and CTUD1 is an instance of CTUD block*)
R_TRIG1(add_elt); R_TRIG2(sub_elt); CTUD1(R_TRIG1.Q, R_TRIG2.Q, reset_cmd, load_cmd,100); full := CTUD1.QU; empty := CTUD1.QD; nb_elt := CTUD1.CV;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal