CTD - Down Counter Function Block

Introduction

The CTD function block decrements a count for each rising edge until the count reaches zero.

Parameters

ParameterTypeDirectionDescription
CDBOOL R_EDGEInputA rising edge decrements the counter value CV by 1.
LDBOOLInputResets the output Q and the counter value CV.
PVINTInputThe counter limit value.
QBOOLOutputSet to true when the counter value CV reaches PV.
CVINTInputThe current counter value.

The Up Counter is logically equivalent to:

Function_Block CTD
        Var_Input CD : BOOL R_EDGE; LD : BOOL; PV : INT; End_Var
        Var_Output Q : BOOL; CV : INT; End_Var

        IF LD THEN
            CV := PV;
        ELSEIF CU AND (CV > 0)
            CV := CV - 1;
        END_IF;

        Q := (CV <= 0);
    End_Function_Block

Standards Compliance

Table 36.2a - IEC 61131-3 2nd Edition.

Table 44.2a - IEC 61131-3 3rd Edition.

Further Information

Standard Function Blocks

To learn about other standard function blocks.

Elementary Data Types

To learn about the different types supported by Fernhill SCADA.

Common Elements

To learn about other IEC 61131-3 Common Elements.

Glossary

For definitions of the terms used in Fernhill SCADA.