# How to use Low Byte Temp for VMB1TS?

I know how to find temperature by dividing High Byte by two (-63 to 63°C with step 0.5)
I would to know how to use Low Byte (4 bits at left) : 0.0625° x Value… but should I add it to first Value (High byte) ???

Thanks
David

Forget the low byte

If you receive command E6, take the first data byte after the command and run it through this code:

``````function ParseTemperature(Value: Byte): Double;
begin
Result := Value;

if Result >= \$80 then
Result := (\$FF - Result + 1) * -1;

Result := Result / 2;
end;``````

Numbers prefixed by the dollar sign “\$” are hexadecimal numbers.

The “Result > \$80” condition is for negative temperatures

Temperature precision is 0.5°C

After many tests and some help, here is a JavaScript code, to calculate temperature with decimal :

``````// Function to calculate temperature with high precision
function TempCurrentCalculation(msg) {
// E6 (Transmit Temp) or EA (Sensor status)
switch (msg) {
case 0xE6:
return msg / 2 - Math.round(((4 - msg) >> 5) * 0.0625 * 10) / 10
case 0xEA:
return msg / 2 - Math.round(((4 - msg) >> 5) * 0.0625 * 10) / 10
default:
console.error("ERROR with TempCalculation", msg)
return undefined
}
}
``````

Hope this will help other coders.

1 Like