Yeni: Yapay zekâ güvenlik duvarı tüm platformu izliyor ve her olayı sade bir dille açıklıyor. Nasıl çalıştığını görün

Reply To: Freezer at -12.5 C shows up as 65411 after going through my Modbus slave

Had the exact same thing in a lab last term with a fridge logger. Modbus registers are just 16 bits, they don’t know about signs. Your Arduino stores -125 as two’s complement, which is 0xFF83, and as an unsigned number that’s 65411. The Pi then reads it as unsigned.

So convert it back on the Pi:

raw = rr.registers[0]
if raw > 32767:          # top bit set means negative in int16
    raw -= 65536
temp = raw / 10           # -12.5

Or let pymodbus do it, the client has a helper for this (in 3.x):

temp = client.convert_from_registers(rr.registers, data_type=client.DATATYPE.INT16) / 10

On the Arduino side, cast before the register so rounding is explicit: holdingRegisters[0] = (uint16_t)(int16_t)lround(temp * 10);. With int16 x10 you have -3276.8 to 3276.7 C, plenty for a freezer.

If a gateway polls it instead of your script, set that register’s type to signed 16-bit in the gateway config and it does the same conversion.

Timestamps in UTC or it didn't happen.
Kabul edilen çözüm♥ 9