5 edge detection, 1 r-trig, R_trig – Lenze DDS v2.3 User Manual

Page 304: Drive plc developer studio

Advertising
background image

Drive PLC Developer Studio

IEC 61131-3 Standard functions

14-12

l

DDS EN 2.3

14.5

Edge detection

14.5.1

R_TRIG

Rising edge detector

FUNCTION_BLOCK R_TRIG
VAR_INPUT

CLK : BOOL;

END_VAR
VAR_OUTPUT

Q : BOOL;

END_VAR
VAR

M : BOOL := FALSE;

END_VAR

Q := CLK AND NOT M;
M := CLK1;

END_FUNCTION_BLOCK

As long as the input variable CLK is FALSE,
the output Q and the auxiliary variable M will be FALSE .

As soon as CLK returns TRUE,
Q will first return TRUE

and then M will be switched to TRUE .

I.e.: with every subsequent function call, Q will return FALSE until CLK has a falling and another rising
edge.

Examples
Declaration:

RTRIGInst : R_TRIG;

IL

FBD

CAL RTRIGInst(CLK:=VarBOOL1)
LD RTRIGInst.Q
ST VarBOOL2

ST

RTRIGInst(CLK:=VarBOOL1);
VarBOOL2:=RTRIGInst.Q;

Show/Hide Bookmarks

Advertising