Accessing A Bit In A Float

Overview

All protocol modules support the ability to access a bit from a Float. This allows client applications to view data based on bits instead of the whole word.

To access a bit from a float use the following syntax with the OPC item name:

ItemName{BA:Bn}
BitMask in "{BA:Bn}"

BA stands for Bit Access, and it is the modifier to use to get bits out of a float.

Bn is the bit number desired.

To access the 7th bit for item Device.40001, the format would be:

Device.40001{BA:64} because 64 is the value of the 7th bit.

Bit Masks can be used to view more than one section of memory at one time. Instead of using the values of 0 – 15 to choose which bit to access, use the combined binary value of the bits.

Binary Values of the Bits

1514131211109876543210
327681638481924096204810245122561286432168421

For example, to get the data for bits 1 and 3, use the bit mask value of 5 since the value of the first bit (1) added to the value of the third bit (4) equals 5.

The tag format would be:

Device.40001{BA:5}.

To get the data for bits 3 and 4, use the bit mask value of 12 (4+8).

The tag format would be:

Device.40001{BA:12}.

Another situation where a bit mask is used is with the DemandIntervals tag. The bit mask value is written to the tag to poll specific intervals.

Bit Values Of Intervals

Interval151413121110987654321
Bit14131211109876543210
Value1638481924096204810245122561286432168421

For example:

To Demand poll Interval 5, Interval 7, and Interval 9, write “336” to the DemandIntervals tag. The “336” is 16+64+256.

To Demand poll Intervals 4, 6, and 8, write “168” to the DemandIntervals tag. The “168” is 8+32+128.

For assistance, please submit a ticket via our Support Portal, email autosol.support@autosoln.com or call 281.286.6017 to speak to a support team member.