Falling edge differential
The DFN instruction executes and turns ON output o for a single scan duration if the trigger i changes from an ON to an OFF state.
Input
Output
Be careful when programming with commands that effect the order in which a program is carried out, e.g. jump or loop instructions within a sequential function chart or a function block. The order of the instructions might change depending on the time when the instruction is carried out or the input value. Specific basic JUMP and LOOP instructions are:
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
Decrement: BOOL:=FALSE;
Counter: INT:=0;
END_VAR
Each falling edge at the input Decrement decrements the couter.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,DFN!,Instance,7,0,12,3,,?Di?Co);
B(B_VARIN,,Decrement,5,1,7,3,);
B(B_F,E_SUB!,Instance,16,0,22,5,,?DEN?D?D?AENO?C);
B(B_VARIN,,Counter,14,2,16,4,);
B(B_VARIN,,1,14,3,16,5,);
B(B_VAROUT,,Counter,22,2,24,4,);
L(12,2,16,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DFN(Decrement) then
Counter:=Counter-1;
END_IF;