Bitwise And (AND)
The AND instruction performs a bitwise AND operation using the bits in Source A and Source B and places the result in Dest.
When enabled, the instruction evaluates the bitwise AND operation: Dest = A AND B
If the bit in
Source A is: | And the bit in
Source B is: | The bit in the
Dest is: |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Available Languages
Ladder Diagram
FactoryTalk Design Studio
DSL - Ladder DiagramOperands
IMPORTANT:
Unexpected operation may occur if:
- Output tag operands are overwritten
- Members of a structure operand are overwritten
- Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
Operand | Data Type | Format | Description |
---|---|---|---|
Source A | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | immediate tag | Value to AND with Source B. //Float includes REAL and LREAL data types. Tip: Float inputs are converted to integer which may cause an overflow. |
Source B | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | immediate tag | Value to AND with Source A. Tip: Float inputs are converted to integer which may cause an overflow. |
Dest | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | tag | Tag to store result of the instruction. Tip: If the destination type is Float, the resultant value will be converted to Float. |
Tip: When integer promotion is required for the inputs, the smaller type is converted to the larger type using zero extension. |
Affects Math Status Flags
Conditional
See Math status flags.
Major/Minor Faults
None specific to this instruction. See Index through arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Rung-condition-in is false | Set Rung-condition-out to Rung-condition-in |
Rung-condition-in is true | Set Rung-condition-out to Rung-condition-in Dest is set as described in the Description section. |
Postscan | N/A |
Examples
Ladder Diagram
Provide Feedback