SF_CTUD (FB)
Description of the function block
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 is a counter FB from the SafetyStandard library. It is an extension of CTUD, a standard IEC 61131-3 function block. The SF_CTUD function block contains both standard data types and safety-related data types (prefix: SAFE).
SF_CTUD fulfills the function of an up and down counter.

Name | Data Type | Initial Value | Description, parameter values |
|---|---|---|---|
|
|
| Rising edge at |
|
|
| Rising edge at |
|
|
|
|
|
|
|
|
|
|
| Start value (count down) /or upper limit for incrementing |
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.