AND block

Short summary

Name

AND

→POU type

→function

Category

IEC-block, Bitstring

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/check.svg no restrictions

Graphical interface

images/download/thumbnails/414780722/AND-version-1-modificationdate-1534860586769-api-v2.png

Available since

version 1.0.0 (for logi.CAD 3)

Functionality

The block returns the result of a bitwise AND operation of all values connected to the inputs of ANY_BIT.

Compare: "IAND block" for AND operation for values of ANY_INT.

Inputs, return value


Identifier

→Data type

Description

Inputs:

IN1

BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT)

1st value

IN2

BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT)

2nd value

... (extensible until)

IN16

BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT)

16th value

Return value:

BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT)


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg Observe that the AND block is a special variant of the blocks for safe logic. See "Blocks for safe logic" for details on this special variant.

Example for usage within ST-editor

PROGRAM Test
VAR
resultB1, resultB2, resultB3, resultB4 : BOOL;
resultW1, resultW2, resultW3, resultW4 : WORD;
END_VAR
 
resultB1 := AND(IN1 := FALSE, IN2 := FALSE); (* The variable 'resultB1' evaluates to 'FALSE'. *)
resultB2 := AND(IN1 := FALSE, IN2 := TRUE ); (* The variable 'resultB2' evaluates to 'FALSE'. *)
resultB3 := AND(IN1 := TRUE, IN2 := FALSE); (* The variable 'resultB3' evaluates to 'FALSE'. *)
resultB4 := AND(IN1 := TRUE, IN2 := TRUE ); (* The variable 'resultB4' evaluates to 'TRUE'. *)
resultW1 := AND(IN1 := 16#0001, IN2 := 16#0001); (* The variable 'resultW1' evaluates to '16#0001'. *)
resultW2 := AND(IN1 := 16#0001, IN2 := 16#0002); (* The variable 'resultW2' evaluates to '16#0000'. *)
resultW3 := AND(IN1 := 16#0003, IN2 := 16#0009); (* The variable 'resultW3' evaluates to '16#0001'. *)
resultW4 := AND(IN1 := 16#0002, IN2 := 16#0002); (* The variable 'resultW4' evaluates to '16#0002'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.