Data inversion and move
This FP instruction logically inverts the data or equivalent constant specified by s and transfers it to the data area specified by d if the trigger EN is TRUE.
Input
Source data to be inverted
Output
Destination data
The variables s and d have to be of the same data type.
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
bStart: BOOL:=FALSE;
(*activates the function*)
wInput_value: DWORD:=16#00001234;
(*this value will be
inverted*)
wOutput_value: DWORD:=0;
(*result after a 0->1 leading
edge from start:
16#FFFFEDCB*)
END_VAR
When the variable bStart is set 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_F,FP_MOVE_INVERT!,,17,0,27,4,,?DEN?D@'s'?AENO?Cd);
B(B_CONTACT,,bStart,6,1,8,3,);
B(B_VARIN,,wInput_value,15,2,17,4,);
B(B_VAROUT,,wOutput_value,27,2,29,4,);
L(8,2,17,2);
L(1,2,6,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF (bStart) then
FP_MOVE_INVERT(s := wInput_value, d => wOutput_value);
END_IF;