Boolean Edge Detection Data Types

Help Contents


Fernhill SCADA supports these edge detection types:

BOOL R_EDGEBoolean rising edge detector0 or 1
BOOL F_EDGEBoolean falling edge detector0 or 1

You can use the R_EDGE or F_EDGE keywords with the BOOL type to generate a pulse on a rising or falling edge.

The type BOOL R_EDGE is equivalent to the function block R_TRIG.

The type BOOL F_EDGE is equivalent to the function block F_TRIG.

Using a Boolean Edge Detection Type

The following example executes a block of code when the tag %"DigitalTag" transitions from FALSE to TRUE:

Program MAIN
        (* The rising edge detector *)
        DetectEdge : BOOL R_EDGE; 

        (* The tag to monitor *)
        TagValue AT %"DigitalTag" : BOOL;

    (* Update the boolean edge value *)
    DetectEdge := TagValue );

    (* Check whether there has been a FALSE to TRUE transition *)
    IF DetectEdge THEN

        (* Code to execute when %"DigitalTag" transitions from FALSE to TRUE *)


Standards Compliance

Table 33.8 - IEC 61131-3 Second Edition.

Table 40.6 - IEC 61131-3 Third Edition.

Note: The implementation follows the recommendation in IEC 61131-8 Guidelines for the application and implementation of programming languages. See section - Use of edge-triggered function blocks. IEC 61131-8 recommends the CLK input of F_EDGE must be first detected as TRUE before a transition from TRUE to FALSE is detected. This contradicts the IEC 61131-3 standard where the output Q will be TRUE following a cold restart with the CLK input disconnected or FALSE.

Further Information

Standard Edge Detection Function Blocks

To learn about the R_TRIG and F_TRIG function blocks.

Elementary Data Types

To learn about elementary data types.

Common Elements

To learn about other language Common Elements.


For the meaning of terms used in Fernhill SCADA.