Bit inversion
NOT performs a bit inversion of input variables. The result will be written into the output variable.
Input
Input for NOT operation
Output
Output as input: Result
All operands must 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
input_value: WORD:=0;
(*type: BOOL, WORD or DWORD*)
negation: WORD:=0;
(*type: BOOL, WORD or DWORD*)
END_VAR
This example uses variables. You can also use a constant for the input variable.
The bits of input_value are inversed (0 is inversed to 1 and vice versa). The inversed result is written into negation.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 2 ;
NETWORK_BODY
B(B_F,NOT!,Instance,10,0,15,2,,?D?C);
B(B_VARIN,,input_value,8,0,10,2,);
B(B_VAROUT,,negation,15,0,17,2,);
L(1,0,1,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
negation:= NOT(input_value);
LD |
input_value |
NOT |
|
ST |
negation |