Skip to main content

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

SF_CTD fulfills the countdown function.

Figure 110. Function block: SF_CTD
Function block: SF_CTD


Table 85. VAR_INPUT

Name

Data Type

Initial Value

Description, parameter values

CD

BOOL

FALSE

Rising edge at CD decrements CV by 1.

LOAD

BOOL

FALSE

TRUE: Sets CV to the initial value PV

FALSE: Counting down is enabled.

PV

SAFEINT

0

Start value (upper limit) for counting down CV.



Table 86. VAR_OUTPUT

Name

Data Type

Initial Value

Description, parameter values

Q

SAFEBOOL

FALSE

Becomes TRUE when CV reaches 0.

CV

SAFEINT

0

Current counter value. From the start value, PV is decremented step by step by 1 until 0 is reached.



FB code

IF LOAD THEN CV := PV;
ELSIF CD AND (CV > PVmin)
    THEN CV := CV-1;
END_IF ;
Q := (CV <= 0) ;

The numerical value of PVmin is 0.