CTUΒΆ

Provided by standard.lib.

Function block Incrementer:

The input variables CU and RESET as well as the output variable Q are type BOOL, the input variable PV and the output variable CV are type WORD.

The counter variable CV will be initialized with 0 if RESET is TRUE. If CU has a rising edge from FALSE to TRUE, CV will be raised by 1.Q will return TRUE when CV is greater than or equal to the upper limit PV.

Declaration example

CTUInst : CTU ;

Example in IL

CAL  CTUInst(CU := VarBOOL1, RESET := VarBOOL2, PV := VarINT1)

LD   CTUInst.Q

ST   VarBOOL3

LD   CTUInst.CV

ST   VarINT2

Example in FBD

../_images/72a5a12e4375786d0a33139006eab46b

Example in ST

CTUInst(CU:= VarBOOL1, RESET:=VarBOOL2 , PV:= VarINT1);

VarBOOL3 := CTUInst.Q ;

VarINT2 := CTUInst.CV;