DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Property: BitMask for BinaryChannelFormatter

Property: BitMask for BinaryChannelFormatter

Specifies the bit mask that masks the value DIAdem reads in.

You can use bit masking to hide single bits when values are read in. The data is masked with an AND operation:

New value = old value AND bit mask

The bit masking is executed before values are calibrated by Factor and Offset.

Object.BitMask
ObjectBinaryChannelFormatter
Object with this property
Object.BitMaskString with read and write access
Note  The bit mask is ignored when R32 values and R64 values are read.
Note  You can specify the value of the bit mask as a decimal, hexadecimal, or octal. 1234 is a decimal value, 0x134 is a hexadecimal value, and 01234 is an octal value.

The following example shows how to mask the fifth bit when channel values are read. You set the bit mask to 25-1 = 16. If the fifth bit is set as a value, the result is 16, otherwise it is zero. However, if you want the channel to only contain the values 0 (bit not set) and 1 (bit set), scale the channel with the factor 1/16 = 0.0625.

Dim oBlock : Set oBlock = File.GetBinaryBlock()
Dim oChn : Set oChn = oBlock.Channels.Add("MyChannel", eI32)
oChn.Formatter.Bitmask = 16
oChn.Factor = 0.0625
Dim oMyGrp: Set oMyGrp = Root.ChannelGroups.Add("MyChannelGroup")
oMyGrp.Channels.AddDirectAccessChannel(oChn)
Was this information helpful?