# determine proprietary 16-bit floating-point format

Background / Introducion

CAN message Mercedes-Benz, cannot determine 16-bit data type for temperature.

``````7E 00 32 01 37 00
``````

According to @rnd-ash (who has reverse engineered ACTIA Basic XS Monitor Software) message is structured data type composed of four values. Now we have bit length + offset but unfortunately data type is unknown.

``````ECU NAME: SAM_V_A2, ID: 0x0017. MSG COUNT: 4
MSG NAME: T_AUSSEN_B - (°C) (° C) Outside air temperature, OFFSET 0, LENGTH 8
MSG NAME: P_KAELTE - (bar) (Bar) pressure refrigerant R134a, OFFSET 8, LENGTH 16
MSG NAME: T_KAELTE - (°C) (° C) temperature refrigerant R134a, OFFSET 24, LENGTH 16
MSG NAME: I_KOMP - (mA) (MA) current compressor main control valve, OFFSET 40, LENGTH 8
``````

@ProjectPhysX suggested it is probably 8/16-bit integer and big endian, so I created that struct. Figured out how to calculate value 0, 1, 3 but unfortunately struggling with value 2

``````typedef struct SAM_V_A2_t {
uint8_t T_AUSSEN_B;
uint16_t P_KAELTE;
uint16_t T_KAELTE;
uint8_t I_KOMP;
} SAM_V_A2_t;
``````

Based on that pictures I can confirm the calculation except for T_KAELTE, which is target of this question (see below).

``````std::cout << "T_AUSSEN_B = " << +( (SAM_V_A2.T_AUSSEN_B - 80) / 2 ) << " (°C) Outside air temperature"               << std::endl;
std::cout << "P_KAELTE = "   << +( SAM_V_A2.P_KAELTE / 10 )         << " (bar) pressure refrigerant R134a"           << std::endl;
std::cout << "T_KAELTE = "   << +( (SAM_V_A2.T_KAELTE - 80) / 2 )   << " (°C) temperature refrigerant R134a"         << std::endl;
std::cout << "I_KOMP = "     << +( SAM_V_A2.I_KOMP * 10 )           << " (mA) current compressor main control valve" << std::endl;
``````
``````  7E             00 32               01 37             00

01111110   00000000 00110010   00000001 00110111   00000000

126               50                 311               0

126 - 80 / 2      50 / 10             ?                0 * 10

23°C              5 bar              ? °C             0 mA
``````

Question

My last hope was it could be `binary16` or `bfloat16` but no luck. Maybe it is some proprietary 16-bit floating-point format with different bits for exponent / mantissa Maybe we can brute force all permutations for exponent / mantissa to determine data type.
Question: How can we decode `01 37` so it gives expected value ~ 21.10 °C

(more sample data here)

• @ProjectPhysX temperature T_KAELTE must be sensor B12/2 on picture 3 and i believe hardware is in voltage Aug 7, 2021 at 13:10
• this is the hardware hehlhans.de/sl55amg-sam-1.htm#b21 and the sensor google.com/search?q=A2038300372 Aug 7, 2021 at 16:46
• datasheet seems not helpful (DATA SEGMENT REGISTER 3 + 4 looks like this) Aug 7, 2021 at 17:11
• think i got it. it is (x - 100) / 10 have confirmed with other records 0x01C4 = 35.2 °C, 0x01D6 = 37.0 °C Aug 8, 2021 at 6:48

To be sure, you would have to take several readings. If you expect that temperature fluctuates by a few °C between measurements, then in `00000001 00110111` only the last few bits should change.