Navigation:  Equipments (Devices) > SCA06 > Ladder > Logic > Logic Boolean >

AND

Previous pageReturn to chapter overviewNext page

Logical block that performs an boolean "and" operation between two variables, storing the result in a third one.

 

Ladder Representation

 

AND_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

Value1

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT

Variable for the operation

Value2

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT

Variable for the operation

VAR_OUTPUT

ENO

BOOL

End of operation

Result

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT

Variable that stores the result of the operation

 

Operation

 

When this block has a TRUE value in EN, it sends to the Result output the "and" Boolean operation of input variables Value1 and Value2.

 

When EN has FALSE value, Result remains unchanged.

 

The ENO value forwards to the next Ladder block the EN value after the operation is completed.

 

Block Flowchart

 

AND_flowchart

 

Example in Ladder

 

AND_example

 

The example above performs an "and" Boolean operation between AUX and AUX2, storing the result in AUX3.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   AUX : BYTE := 2#1100_1010;

   AUX2 : BYTE := 2#1011_1001;

   AUX3 : BYTE;

END_VAR

 

AUX3 := FB_AND(

   EN:=DI1,

   Value1:=AUX,

   Value2:=AUX2,

   ENO=>DO1);