Exclusive OR operation
The content of the accumulator is connected with the operand defined in the operand field by a logical XOR operation. The result is transferred to the accumulator.
Input
1st input: element 1 of logical XOR operation
2nd input: element compared to input 1
Output
Output as input: result
Input 1 |
Input 2 |
Output |
|
---|---|---|---|
Signal |
0 |
0 |
0 |
1 |
0 |
1 |
|
0 |
1 |
1 |
|
1 |
1 |
0 |
VAR
bvar_1: BOOL:=FALSE;
(*Input 1*)
bvar_2: BOOL:=FALSE;
(*Input 2*)
bvar_3: BOOL:=FALSE;
(*Output*)
END_VAR
The Boolean variables bvar_1 and bvar_2 are logically EXCLUSIVE-OR linked and the result is written in bvar_3.
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,@XOR-2!,,10,1,15,4,,?D?D?C);
B(B_VARIN,,bvar_1,8,1,10,3,);
B(B_VARIN,,bvar_2,8,2,10,4,);
B(B_VAROUT,,bvar_3,15,1,17,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
var_3:= var_1 XOR var_2;
LD |
bvar_1 |
(* Load bvar_1 in accu *) |
XOR |
bvar_2 |
(* Perform an XOR of accu with bvar_2; store result in accu *) |
ST |
bvar_3 |
(* Store accu in bvar_3 *) |