|
Tip |
|---|---|
|
The version of the function block as described here corresponds to the latest version of the function block in Version list of function blocks. |
|
Tip |
|---|---|
|
|
SF_CTUD fulfills the function of an up and down counter.
Table 88. VAR_INPUT
|
Name |
Data Type |
Initial Value |
Description, parameter values |
|---|---|---|---|
|
|
|
|
Rising edge at |
|
|
|
|
Rising edge at |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Start value (count down) /or upper limit for incrementing |
Table 89. VAR_OUTPUT
|
Name |
Data Type |
Initial Value |
Description, parameter values |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Current counter value of the counter |
FB code
IF R THEN CV := 0 ;
ESLIF LOAD THEN CV := PV ;
ELSE
IF NOT (CU AND CD) THEN
IF CU AND (CV < PVmax)
THEN CV := CV+1;
ELSIF CD AND (CV > PVmin)
THEN CV := CV-1;
END_IF;
ENDIF;
ENDIF;
QU := (CV >= PV) ;
QD := (CV <= 0);
The numerical value of PVmin is 0. The numerical value of PVmax is 32767.