Logical AND operation
The content of the accumulator is connected with the operand defined in the operand field by a logical AND operation. The result is transferred to the accumulator.
Input
1st input: element 1 of logical AND operation
2nd input: element compared to input 1
Output
Output as input: result
Input 1 |
Input 2 |
Output |
|
---|---|---|---|
Signal |
0 |
0 |
0 |
0 |
1 |
0 |
|
1 |
0 |
0 |
|
1 |
1 |
1 |
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
bvar_1: BOOL:=FALSE;
(*Input 1*)
bvar_2: BOOL:=FALSE;
(*Input 2*)
bvar_3: BOOL:=FALSE;
(*Output*)
END_VAR
bvar_1 will be logically AND-linked with bvar_2. The result will be written into the output variable 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,@AND-2!,Instance,5,1,10,4,,?D?D?C);
B(B_VARIN,,bvar_1,3,1,5,3,);
B(B_VARIN,,bvar_2,3,2,5,4,);
B(B_VAROUT,,bvar_3,10,1,12,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
bvar_3:= bvar_1&bvar_2;
LD |
bvar_1 |
(* Load bvar_1 in accu *) |
AND |
bvar_2 |
(* Perform an AND of accu with bvar_2; store result in accu *) |
ST |
bvar_3 |
(* Store accu in bvar_3 *) |