AND

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.

Parameters

Input

Unnamed input (BOOL, WORD, DWORD)

1st input: element 1 of logical AND operation

Unnamed input (BOOL, WORD, DWORD)

2nd input: element compared to input 1

Output

Unnamed output (BOOL, WORD, DWORD)

Output as input: result

Remarks

  • All operands must be of the same data type.
  • This function can be expanded to a maximum of 28 input contacts, see also modifying elements.

Truth table:

Input 1

Input 2

Output

Signal

0

0

0

0

1

0

1

0

0

1

1

1

Example

POU header

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

POU body

bvar_1 will be logically AND-linked with bvar_2. The result will be written into the output variable bvar_3.

LD body

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

ST body

bvar_3:= bvar_1&bvar_2;

IL body

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 *)

Modified on: 2019-01-24Feedback on this pagePanasonic hotline