Contents Up Previous Next

Data format

Data is sent by the modules in Intel format ("little Endian") and interpreted in this format upon reception.

If there is any uncertainty about the endianness when setting up the own driver, use ,,CHECK MC PC COMMUNICATION'', or ,,CHECK PC MC COMMUNICATION'' with predefined test data.


Floating point values

The IEEE ,,Standard for Binary Floating-Point Arithmetic'' (IEEE 754) was developed in the early 1980s in order to cater for consistent floating point representation in different computer architectures. If parameters are sent as floating point numbers to/from the modules, this standard applies. A floating point number is thereby represented as a 32-bit value.

Plus/minus sign bit Exponent Mantissa (standardized)
1 bit (bit 32) 8 bit (bit 23.. bit 30) 23 bit (bit 1.. bit 22)
s e f

As the mantissa is always set to "1", only the decimals are stored, as the leading "1" does not need to be recorded. A floating point value can thus be calculated as follows:

(-1)^(s)*2^(e-127)*(1.f)(bin)
Examples:

Sign Exponent Mantissa
1 bit 8 bit 23 bit
7/4 0 01111111 11000000000000000000000
-34.432175 1 10000100 00010011011101010001100
-959818 1 10010010 11010100101010010100000
+0 0 00000000 00000000000000000000000
-0 1 00000000 00000000000000000000000
2^(-126), or 1.175*10^(-38)
Smallest positive number 0 00000001 00000000000000000000000
(2-2^(-23)) 2^(127), or 3.403*10^(38)
Largest positive number 0 11111110 11111111111111111111111
infinite 0 11111111 11111111111111111111111
NaN 0 11111111 not all ,,0'' or ,,1''
Macheps 2^(-23), oder 1.192*10^(-7)
Smallest distinct number 0 01101000 00000000000000000000000
2^(-128) 0 00000000 01000000000000000000000

Two's complement

The two's complement offers a way of displaying negative numbers in the binary system. In the module, the two's complement is used for the representation of negative integers. (Integer system).

Positive numbers are represented as two's components with a leading 0 (sign bit). They are not further encoded. Negative numbers are represented with a leading 1 (sign bit) and encoded as follows: all digits of the corresponding positive figure are negated. The value 1 is added to the result. Example of the conversion of the negative decimal figure -4(dec) in a two's complement:

  1. Ignore sign and convert to binary system: 4(dec)=00000100(bin)=0x04(hex)
  2. Invert, as the value is negative: 11111011(bin)=0xFB(hex)
  3. Add 1, as figure is negative: 11111011(bin) + 00000001(bin) = 11111100(bin) = 0xFC(hex)= -4(dec)

Or more mathematically:
Is x is a negative number, x is represented as a two's complement (x(z)) with n digits as follows:

x(z)=2^(n)-|x|
This means that the following equation applies:
x(z)+|x|=2^(n)

As the module, when set to ,,Integer system'' always works with Int32 (4 bytes), the byte sequences of negative numbers x (e.g. -112) can be calculated easily as follows:

y=4294967296(dec)-|x|--> y=4294967296_dec-112(dec)=4294967184(dec)
y=0x100000000(hex)-|x|--> y=0x100000000(hex)-0x70(hex)=0xFFFFFF90(hex)