Page tree
Skip to end of metadata
Go to start of metadata

In some applications an integer datapoint is treated as a bit field, i.e. each bit has its specific meaning. Consequently, each bit should be available as datapoint to be read and/or written separately.

KNX

For KNX the following datatypes are available

data lengthsuitable DPT
1 byteDPT_21.1010
2 bytesDPT_22.1010
3 bytesDPT_30.1010
4 bytesDPT_27.001

Incoming data is automatically split in its sub-datapoints. To set specific bits, write the respective sub-datapoints and send the outgoing telegram by writing 1 to the WRITE sub-field.

Find more information on complex KNX datatypes in this article.

Generic implementation for all protocols

This step-by-step guide shows how to access single bits in datapoints of any source. This is shown by the example of a Modbus datapoint, NETx\XIO\Modbus\ModbusGW1\Holding Registers\13000.

  1. Stop the BMS Server and get following XLogic extensions via Extensions / Manager:
  2. Set up virtual datapoints for the single bits and the write trigger
    • Go to Extensions / Virtual item definitions.
    • Define a datapoint for each bit.
    • Define a datapoint for the write trigger.
    • Use a suitable Path setting to structure the created datapoints
    • Save the definitions and restart the BMS Server. You will find the created datapoints in the VIRTUAL branch of the item tree:
  3. Set up the splitting of the source datapoint into the single bits in Extensions / XCommand event definitions:
    • Create a new definition and choose a suitable name. Set the type to ON_VALUE_CHANGE.
    • Choose the XCommand SPLITWORDINTOBITS.
    • Set Input_Item_1 to the datapoint you want to split. In our example this is NETx\XIO\Modbus\ModbusGW1\Holding Registers\13000.
    • Set Output_Item_1 to 16 to the corresponding virtual datapoints.

    • Save and restart the BMS Server to test the splitting or proceed with the next step.
  4. Set up the writing of the bits to the destination datapoint in Extensions / XCommand event definitions:
    • Create a new definition and choose a suitable name. Set the type to ON_INPUT.
    • Choose the XCommand WRITEBITSTOWORD.
    • Set Write Trigger to the virtual write item.
    • Set Output_Item to the target on the fieldbus, NETx\XIO\Modbus\ModbusGW1\Holding Registers\13000.
    • Set Bit1 to Bit16 to the virtual items of the corresponding bits.
    • Save and restart the BMS Server.

How it works

The SPLITWORKINTOBITS XCommand splits the datapoint every time the value is changed. This is the case on incoming data and if the item is set in the server.

The WRITEBITSTOWORD XCommand takes the single bits and combines them to a value that is sent to the output. The command is triggered every time its input item Write Trigger is written, no matter which value.

BMS Studio Testing

Tests in the BMS Studio can be done like this:

  • Modify the value of the field bus datapoint and watch as the single bits change:



  • Edit bits and use the WRITE item to trigger:

Using in Visualization

You can set up a visual represesentation of the bit field like this:

A label element of type control can be used to show and modify the value of the datapoint.

A LED-like button can be used to both indicate and switch status of a specific bit.

Operation mode is Switch, ON and OFF should be 1 and 0, respectively. The server item for the bit is connected for sending and receiving. The write trigger is connected send-only.

Attached export of the visualization demo: bits.vew