Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
19
Добавлен:
11.10.2020
Размер:
3.39 Mб
Скачать

328 Standard Library Elements

Counter

Example in ST:

FTRIGInst(CLK:= VarBOOL1);

VarBOOL2 := FTRIGInst.Q;

13.4 Counter

13.4.1CTU

The 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 INT.

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:

Example in ST:

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

VarBOOL3 := CTUInst.Q ;

VarINT2 := CTUInst.CV;

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Standard Library Elements

329

Counter

 

 

 

13.4.2CTD

Function Block Decrementer:

The input variables CD and LOAD as well as the output variable Q are type BOOL, the input variable PV and the output variable CV are type INT.

When LOAD_ is TRUE, the counter variable CV will be initialized with the upper limit PV. If CD has a rising edge from FALSE to TRUE, CV will be lowered by 1 provided CV is greater than 0 (i.e., it doesn't cause the value to fall below 0).

Q returns TRUE when CVis equal 0.

Declaration example:

CTDInst : CTD ;

Example in IL:

CAL

CTDInst(CD := VarBOOL1, LOAD := VarBOOL2, PV :=

 

VarINT1)

LD

CTDInst.Q

ST

VarBOOL3

LD

CTDInst.CV

ST

VarINT2

Example in FBD:

Example in ST:

CTDInst(CD:= VarBOOL1, LOAD:=VarBOOL2 , PV:= VarINT1);

VarBOOL3 := CTDInst.Q ;

VarINT2 := CTDInst.CV;

13.4.3CTUD

Function Block Incrementer/Decrementer:

The input variables CU, CD, RESET, LOAD as well as the output variables QU and QD are type BOOL, PV and CV are type INT.

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

330 Standard Library Elements

Counter

If RESET is valid, the counter variable CV will be initialized with 0. If LOAD is valid, CV will be initialized with PV.

If CU has a rising edge from FALSE to TRUE, CV will be raised by 1. If CD has a rising edge from FALSE to TRUE, CV will be lowered by 1 provided this does not cause the value to fall below 0.

QU returns TRUE when CV has become greater than or equal to PV.

QD returns TRUE when CV has become equal to 0.

Declaration example:

CTUDInst : CUTD ;

Example in IL:

CAL CTUDInst(CU := VarBOOL2, RESET := VarBOOL3, LOAD := VarBOOL4, PV := VarINT1)

LD CTUDInst.QU

ST VarBOOL5

LD CTUDInst.QD

ST VarBOOL6

LD CTUDInst.CV

ST VarINT2

Example in FBD:

Example in ST:

CTUDInst(CU := VarBOOL1, CU:= VarBOOL2, RESET :=

VarBOOL3, LOAD:=VarBOOL4 , PV:= VarINT1);

VarBOOL5 := CTUDInst.QU ;

VarBOOL6 := CTUDInst.QD ;

VarINT2 := CTUDInst.CV;

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32