Skip to main content

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

Its function is the counting up of a counter to a defined upper limit.

Figure 111. Function block: SF_CTU
Function block: SF_CTU


Table 87. VAR_INPUT

Name

Data Type

Initial Value

Description, parameter values

CU

BOOL

FALSE

Rising edge at CU increments CV by 1.

RESET

BOOL

FALSE

TRUE: Resets the CV counter to 0.

PV

SAFEINT

0

Upper limit for counting up CV.



Table 88. VAR_OUTPUT

Name

Data Type

Initial Value

Description, parameter values

Q

SAFEBOOL

FALSE

TRUE: Counter CV has reached the upper limit PV.

CV

SAFEINT

0

Current counter value. Increments until PV is reached.



FB code

IF R THEN CV := 0 ;
ELSIF CU AND (CV < PVmax)
    THEN CV := CV+1;
END_IF ;
Q := (CV >= PV) ;

The numerical value of PVmax is 32767.