R_TRIG / R_TRIG_S - Rising edge detector
This edge detection function block detects a rising edge. If a rising edge is detected at the input CLK, the output Q changes from FALSE to TRUE. Q remains TRUE for one execution of the function block. If the function block is called for the first time, Q is FALSE until the first rising edge is detected.
The function block is available as standard function block R_TRIG and safety-related function block R_TRIG_S.
R_TRIG
Parameter |
Data types |
Description |
CLK |
BOOL |
Detects a rising edge |
Q |
BOOL |
If a rising edge is detected, Q changes from FALSE to TRUE |
R_TRIG_S
Parameter |
Data types |
Description |
CLK |
SAFEBOOL |
Detects a rising edge |
Q |
SAFEBOOL |
If a rising edge is detected, Q changes from FALSE to TRUE |
NOTE:
Function blocks have to be instantiated. Like variables, instances have to be declared before they can be inserted in a code body. Instances must be unique within the POU. In the following example, the instance name 'R_TRIG_S_1' is used for the R_TRIG_S FB.
Example for a safety-related function block declaration R_TRIG_S
Variables declarations in this example
NOTE:
If you want to use the standard function block R_TRIG in your code worksheet, you have to select the data type 'R_TRIG' for the function block instance in the local variables worksheet. Accordingly, the data type 'BOOL' must be used instead of 'SAFEBOOL'.