CTDΒΆ
Provided by Standard Library.
Function block working as a decrementer.
Inputs:
CD : BOOL; With each rising edge at this input the counter value (CV) is decremented by 1 until 0 is reached.
LOAD : BOOL; If TRUE, CV will be set to the start value given by PV.
PV : WORD; start value for decrementing of CV.
Attention
Datatype WORD, which is used for PV in CODESYS, does not match the IEC standard, which for PV defines datatype INT.
Outputs:
Q : BOOL; gets TRUE as soon as CV is 0.
CV : WORD; gets decremented by 1, starting with PV until 0 is reached.
Declaration example:\ \ \ \
CTDInst : CTD ;
Example in IL:\ \ \ \
Example in FBD:\ \ \ \ :
Example in ST:\ \ \ \
CTDInst(CD:= VarBOOL1, LOAD:=VarBOOL2 , PV:= VarWORD1);
VarBOOL3 := CTDInst.Q ;
VarWORD2 := CTDInst.CV;