CTU: Up Counter Function Block

Help Contents

Introduction

The CTU Function block counts rising edges until a preset limit is reached.

Parameters

ParameterTypeDirectionDescription
CUBOOL R_EDGEInputA rising edge increments the counter value CV by 1.
RBOOLInputResets 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 CTU
    Var_Input CU : BOOL R_EDGE; R : BOOL; PV : INT; End_Var
    Var_Output Q : BOOL; CV : INT; End_Var

    IF R THEN
        CV := 0;
    ELSEIF CU AND (CV < PV )
        CV := CV + 1;
    END_IF;

    Q := (CV >= PV);
End_Function_Block

Standards Compliance

IEC 61131-3 Second Edition: Table 36.1a.

IEC 61131-3 Third Edition: Table 44.1a.

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 the meaning of terms used in Fernhill SCADA.