Increment
This FP instruction adds 1 to the data specified by d if the trigger EN is TRUE. The result is stored in d.
Input/output
Data to be incremented by 1 and result
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
start: BOOL:=FALSE;
(*activates the function*)
increment_value: DINT:=131081;
(*result after a 0->1 leading
edge from start: 131082*)
END_VAR
When the variable bStart changes from FALSE to TRUE, the function is carried out.
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_CONTACT,,start,4,2,6,4,R);
B(B_VARIN,,increment_value,12,3,14,5,);
B(B_VAROUT,,increment_value,20,3,22,5,);
B(B_F,FP_INC!,,14,1,20,5,,?DEN?Dd?Ad?AENO);
L(1,3,4,3);
L(6,3,14,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(start) then
FP_INC(increment_value);
END_IF;