CTD (FB)

 

FUNCTION_BLOCK CTD

Decrements a given value

(* Example declaration *)
CTDInst : CTD ;

(* Example in ST *)
CTDInst(CD:= VarBOOL1, LOAD:=VarBOOL2 , PV:= VarWORD1);
VarBOOL3 := CTDInst.Q ;
VarWORD2 := CTDInst.CV;

InOut:

Scope

Name

Type

Comment

Input

CD

BOOL

Rising edge: Decrementing CV by one

LOAD

BOOL

TRUE: Set CV to the start value PV

PV

WORD

Start value for decrementing

Output

Q

BOOL

TRUE if CV = 0

CV

WORD

Current counter value