Bit Fields Tab
A bit field packs multiple pieces of data together in one variable. Each field represents one piece of data. Each piece of data should have no dependency upon other fields. Bit Fields are used to define custom variable types and values.
Adding Bit Fields
A Bit Field may be created in one of three ways:
- Right-click within the Bit Fields tab and select Insert BitFields.
- Press the Insert key while the Bit Fields tab is active
- Double-click within the Bit Fields tab.
This creates a default Bit Field labelled as "BitFieldn
" with a Value type "INT
".
- The Bit Field type Value may be modified by double-clicking on value, allowing a selection from a list.
Once the Type is defined you may populate the bits.
- Double click on a bit value to change the text.
-
-
To save your changes you must press Enter, Tab, the Up, or the Down arrow key.
-
-
Bit Fields are supported over MODBUSModBus is a serial communications protocol and is now the most commonly available means of connecting industrial electronic devices. ModBus is often used to connect a supervisory computer with a remote terminal unit in supervisory control and data acquisition (SCADA) systems. Versions of the ModBus protocol exist for serial port and Ethernet (it is widely used with TCP/IP over Ethernet). Below is a variable with a custom Type defined in the Bit Fields list which is flagged for KVB. It will be exported.to MODBUS.
Using Bit Fields
Following is an example of setting up and testing a Bit Fields entry.
- Define the Bit Field Type and Values.
Here we have defined a bit called AxisState with four values.
- Create a variable whose Type that matches the Bit Field.
Here we have defined a variable called Motor_State. We selected the AxisState type from the dropdown menu.
- To use the bit enter
VariableName.BitName
in any editor.Here we are using the Structured Text editor and typed "
motor_state.
" When the dot was typed the selector opened, showing us the available bits for the variable.