You are here: Technical References > Programming Languages > PLC Standard Libraries > CTUD / CTUDr

CTUD / CTUDrPLCopen motion icon

FunctionA function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. Block - Up/down counter.

Inputs

CU : BOOL     EnableEnable signal for the drive, Hardware-Enable with 24V signal to X8, Software-Enable command by setup Software, fieldbus or permanently set. Both are required for enabling the drive. counting. Counter is increased on each call when CU is TRUE
CD : BOOL     Enable counting. Counter is decreased on each call when CD is TRUE
RESET : BOOL  ResetNew start of the microprocessor command. Counter is reset to 0 called with RESET to TRUE
LOAD : BOOL   Re-load command. Counter is set to PV when called with LOAD to TRUE
PV : DINT     Programmed maximum value

Outputs

QU : BOOL     TRUE when counter is full, i.e. when CV = PV
QD : BOOL     TRUE when counter is empty, i.e. when CV = 0
CV : DINT     Current value of the counter

Remarks

The counter is empty (CV = 0) when the application starts. The counter does not include a pulse detection for CU and CD inputs. Use R_TRIG or F_TRIG function blocks for counting pulses of CU or CD input signals. In FFLD language, CU is the input rung. The output rung is the QU output.

CTUr, CTDr, CTUDr function blocks operate exactly as other counters, except that all Boolean inputs (CU, CD, RESET, LOAD) have an implicit rising edgeA rising edge is the transition of a digital signal from low to high. It is also called positive edge detection included.

ST Language

(* MyCounter is a declared instance of CTUD function block *)
MyCounter (CU, CD, RESET, LOAD, PV);
QU := MyCounter.QU;
QD := MyCounter.QD;
CV := MyCounter.CV;

FBD Language

CtudFbd.gif (1604 octets)

FFLD Language

CtudLd.gif (1724 octets)

IL Language:

(* MyCounter is a declared instance of CTUD function block *)
Op1: CAL    MyCounter (CU, CD, RESET, LOAD, PV)
FFLD     MyCounter.QU
ST     QU
FFLD     MyCounter.QD
ST     QD
FFLD     MyCounter.CV
ST     CV

See also

CTU   CTD

 


Stay Connected with Kollmorgen

Copyright © 2015 Kollmorgen™