The Bit And function block provides bitwise output by performing logical AND operation bitwise between inputs In and Mask value.
It works on the bits of the input rather than the truth value of the input. Bitwise binary AND does the logical AND of the bits in each position of a number in its binary form. It compares each bit of the input to the corresponding bit of the mask value. If both bits are 1, the corresponding result bit is set to "1". If not, the corresponding result bit is set to "0".
Figure 1: BitAnd-Function Block |
Figure 2: BitAnd-Property Sheet |
If In or Mask ="null", Out and Out Eq Zero = "null". If Enable is set to "false", Out = In and EqZero = "false".
Figure 3: BitAnd-Logic Diagram
Input
Input Name |
Description |
Enable |
This is a boolean point. If it is set to set to "true", it enables the function block. |
In |
Integer value |
Mask (In & Par) |
Integer value |
Table 1: Inputs of BitAnd Function
Output
Output Name |
Description |
Out |
Out = In BitAnd Mask |
Out Equal Zero |
If Out is zero, then Out Equal Zero is "true" |
Table 2: Outputs of BitAnd Function
Parameter
Parameter Name |
Description |
Mask Par (In & Par) |
If Mask is "null" or not connected, Mask Par is used as parameter. |
Out Save |
Master Sync Enabled : If you set it to "true" the last output will be set as output for one cycle after the controller restarts. The application can use it to return to the same state before the controller restart. Out: To enable or disable the Out Save feature. Out Equal Zero:To enable or disable the Out Equal Zero feature. |
Table 3: Parameter of BitAnd Function
Examples:
1. In is "6" and Mask is "5".
Name of the inputs and output |
Integer |
Binary |
||
In |
6 |
1 |
1 |
0 |
Mask |
5 |
1 |
0 |
1 |
Out |
4 |
1 |
0 |
0 |
Output Equal Zero |
false |
|
Figure 4: Example-In "6" and Mask "5"
2. In is "4" and Mask is "3".
Name of the inputs and output |
Float |
Binary |
||
In |
4 |
1 |
0 |
0 |
Mask |
3 |
0 |
1 |
1 |
Out |
0 |
0 |
0 |
0 |
Output Equal Zero |
true |
|
Figure 5: Example-In "4" and Mask "3"
3. In is "4" and Mask is "3". Enable is set to "false".
Figure 6: Example-In "4" and Mask "3"
Refer to General Description for general information about IRMN4 Function Blocks.