Introduction
What happens if you want to serve some/all of the bits that form a 16 bit register. ie. Your client reads a 16bit register but you want to serve those bits as separate binary objects.
Here is an example
The 1st Move copies 1x 16 bit number from DA_REG[0] to DA_PACKED[0].
DA_Packed’s offsets can be interpreted in two ways:
- A series of 16 bit numbers
- A series of bits
It depends on what kind of operation access the Data Array. If it’s a 16 bit or analog number type operation then it addesses 16 bit numbers. If the operation is a bit operation like for a binary data point then the operation addresses each bit.
Therefore DA_PACKED[0] is ambiguous.
If you connected a server Map Descriptor to that point and the type is an Analog In/output then it means the 16bit number found at DA_PACKED[0].
If you connected a server Map Descriptor to that point and the type is an Binary In/output then it means the bit number found at DA_PACKED[0] and DA_PACKED[15] is the 16th bit. DA_PACKED[16] is the 1st bit of the next 16 bit number…
If that seems to complicated then add one more move:
Data_Arrays
| Move_Only | DA_PACKED | 0 | DA_BIT | 0 | 16 |
This move moves the 16 bits for DA_PACKED[0] to 16 separate bits with unambiguous offsets and you can use those in the server map descriptors.
Heads Up
| Data_Array_Name | Data_Format | Data_Array_Length |
| DA_REG | UINT16 | 20 |
| DA_PACKED | Packed_Bit | 100 |
| DA_BIT | BIT | 1200 |
Preloads
| Data_Array_Name | Preload_Data_Index | Preload_Data_Value |
| DA_REG | 0 | 33 |
Moves
| Function | Source_Data_Array | Source_Offset | Target_Data_Array | Target_Offset | Length |
| Move_Only | DA_REG | 0 | DA_PACKED | 0 | 1 |
| Move_Only | DA_PACKED | 0 | DA_BIT | 0 | 16 |
Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!
Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have
0 Responses to “Unpacking Bits from a 16bit Register in a FieldServer Configuration”