Hello. I'm needing help to create a mask in a 16 bit word. I can not do the syntax.

I need to isolate the data from the first 8 bits.

I used this syntax.

IF ([UG1-M11.4:1181] & 255 == 255,1,0)

It is returning 1, but should return 0, because in the first 8 bits the data is 0000.0000.

**OPC Manual Help**

Problem: How can I access individual bits from an integer item?

Solution: In order to do this, users will have to apply a mask to the value, which will null all of the bits in the integer value except the one that users want to keep.

For example, if the user wanted to isolate the third bit, they would have to apply a mask that is in binary which will only have the third bit present. In binary, this is the number 4 (0100).

To apply the mask, users must use the AND operator, which will leave a 1, if and only if, both the bits in that position are 1.

0110 1100

+ 0000 0100

= 0000 0100

In decimal notation, this would be expressed as 108 AND 4 = 4.

To do this in an OPC server, users would configure an Alias to use the IF operator. With the example above, where the user wishes to access the third bit in the integer, the statement would appear as:

IF (INPUT AND 4 = 4, 1, 0)

Therefore, if the bit in position 3 is a 1, since 1 AND 1 =1, the IF statement would be true and would return a 1. If the bit in position is 0, 0 AND 1 = 0, the IF statement would return a false value, which is a 0.