modelUnpackUnsignedInteger
Extends from Modelica_DeviceDrivers.Utilities.Icons.SerialPackagerReadIcon, Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.Internal.PartialSerialPackager.
Information
The block allows to unpack unsigned integer values on bit level. The number of bits used for decoding is set by parameter width. The parameter bitOffset allows to specify the bit at which the decoding starts relative to the preceding block.
If an GetBoolean, GetInteger, GetReal or GetString block follows an UnpackUnsignedInteger block the bit position after the UnpackUnsignedInteger block is aligned to the next byte boundary.
Endianness
Currently, the pack block only supports Intel-Endianness (little-endian!).
For information about endianness in computing see for example http://en.wikipedia.org/wiki/Endianness
Example
The block is used in example
TestSerialPackagerBitPack_UDP, depicted below.

GetInteger block. Assume that we had the memory layout below and would like to unpack the second Integer value. A '.' denotes that the bit is not part of the bits encoding the value (LSB = Least Significant Byte and MSB = Most Significant Byte).
byte 24 byte 25 byte 26 byte 27 byte 28
LSB MSB
Relative bit position in Memory: 0-7 8-15 16-23 (24 25 26 27 28 29 30 31) (32 33 34 35 36 37 38 39) (..
Value of bit : 0 1 . . . . . . 0 0 0 0 0 0 0 1
The value of the unpacked second Integer value would be 5 (decimal) == 101 (binary).
See also PackUnsignedInteger.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | nu (from PartialSerialPackager) | 0 | Output connector size |
| Integer | bitOffset | 0 | Bit offset from current packager position until first encoding bit |
| Integer | width | 32 | Number of bits that encode the integer value |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Interfaces.PackageIn | pkgIn (from PartialSerialPackager) | ||
| Interfaces.PackageOut[nu] | pkgOut (from PartialSerialPackager) | ||
| Modelica.Blocks.Interfaces.IntegerOutput | y |