Modbus Magic Numbers: 32768 (0x8000), 65535, NaN, and Coil Write Values Explained

What reserved bit patterns mean in Modbus registers — sentinel values like 0x8000, 0xFFFF, and IEEE 754 NaN, signed/unsigned mismatches, word-order errors, and the FC05 coil write requirement.

Overview

If a Modbus register is showing 32768, it almost always means one of three things: the device is reporting that it has no valid value, the client is reading a signed integer as unsigned, or a 32-bit multi-register value is being assembled in the wrong word order.

32768 is 0x8000 in hex — binary 1000 0000 0000 0000. That is the sign bit of a 16-bit value, sitting alone. It has no plausible relationship to a real process variable, which is exactly why it keeps appearing as a sentinel and as a mismatch artifact.

[!TIP] The fastest way to triage 32768 is to ask one question: does the value move when the process changes? If it is stuck at exactly 32768 regardless of what the sensor sees, it is a sentinel. If it varies but is wrong in a predictable way, it is a data-type or word-order mismatch.

Quick Diagnosis

SymptomMost Likely CauseFirst Action
Every register shows exactly 32768, value never changesSentinel — device has no valid data for that pointCheck whether Modbus output is enabled on the device; verify the register map
Negative values appear as 32768 or values near 65535Signed/unsigned mismatchChange the client data type from UINT16 to INT16
32-bit float or integer is wrong but not constantWord order mismatchTry the other three word-order combinations
Some points read correctly, others show 32768Mixed sentinel — some points unmapped, others activeRead the device register map; check which points require configuration

Cause 1: Sentinel Value

Modbus has no built-in concept for “no data,” “not available,” or NaN. Vendors invent their own. 0x8000 is the most common choice because it sits at the boundary of the signed range and is effectively impossible as a real process value.

Symptom: The register returns exactly 32768 regardless of process state. It does not change when you adjust the input or change operating conditions.

Common root causes:

  • Modbus output or mapping is not enabled on the device (common on power meters and energy analyzers)
  • The sensor or input is unplugged or unconfigured
  • The register address is correct but the function code is wrong — for example, reading holding registers with FC04 instead of FC03
  • The point exists in the register map but the device has never been commissioned to write it
  • A gateway upstream of the Modbus device has lost communication with its source

How to confirm: Read the raw bytes with a Modbus scanner or Wireshark. If the wire shows 0x80 0x00, the device is genuinely sending 0x8000. Check the device documentation or vendor register map for language like “invalid,” “not available,” “NaN,” or “fault value” to confirm this is a defined sentinel.

Field example: In a power-meter integration involving a Schneider PM8000, all registers returned 32768 while Modbus communication was otherwise functional. The root cause was that the Modbus register mapping had not been enabled in the meter configuration. Once activated through the meter’s commissioning tool, the points populated correctly. See also Modbus Troubleshooting Guide.

Cause 2: Signed vs. Unsigned Mismatch

Modbus does not specify whether 16-bit register values are signed or unsigned. The device and client must agree. When a device sends a negative INT16 value and the client reads it as UINT16, the result wraps around: -1 becomes 65535, -11 becomes 65525, and -32768 becomes exactly 32768.

Pattern check:

Wire value (hex)INT16 interpretationUINT16 interpretation
0xFFFF−165535
0xFFF5−1165525
0x8000−3276832768

Symptom: Values near 65535 where small negatives are expected, or 32768 where a large negative process value is expected. The value changes with process conditions but is always wrong by a predictable offset.

Fix: Change the client data type from UINT16 to INT16. On a QuickServer or FieldServer, review the data type field in the point map. See Modbus Data Types & Byte Order Reference for a full list of register data types.

Cause 3: Word Order on 32-Bit Values

This cause applies only to 32-bit values (FLOAT32, INT32, UINT32) that span two consecutive 16-bit registers. Modbus does not define word order for multi-register values, so four conventions exist in the field:

ConventionAlso CalledHigh WordLow Word
ABCDBig-endianRegister NRegister N+1
CDABWord-swappedRegister N+1Register N
BADCByte-swappedRegister N (bytes reversed)Register N+1 (bytes reversed)
DCBAFully reversedRegister N+1 (bytes reversed)Register N (bytes reversed)

Symptom: The 32-bit value varies with process conditions but is wrong in a non-linear way. 32768 can appear when the high bit of one source byte ends up isolated in the high position of a reassembled register after the wrong word-order combination is applied.

Fix: Try the other three conventions in the client. Look for dropdown options labeled “word order,” “byte order,” “swap words,” or ABCD/CDAB/BADC/DCBA. Validate against one independently known process value — a display reading, a commissioning document, or a value from an incumbent system.

See Modbus Word Order and Byte Order and Endianness Reference for a full explanation of word-order conventions and how to test them.

Reading the Wire

When the cause is not immediately clear, capture the raw bytes before changing any configuration.

  • Modbus TCP: Wireshark dissects Modbus TCP natively. Filter on modbus or tcp.port == 502. See Wireshark Modbus TCP Capture and Diagnose for a step-by-step capture procedure.
  • Modbus RTU: Use a serial sniffer, a gateway debug log, or the CAS Modbus Scanner in raw-byte mode.

What the bytes tell you:

Wire bytesClient showsInterpretation
0x80 0x00 — constant32768Device is sending 0x8000. Sentinel or signed/unsigned mismatch. Check register map first.
Bytes vary meaningfully32768 or garbageWord-order mismatch. The bytes are changing but being assembled incorrectly.
Bytes vary but client is staticSame wrong valueWrong register address or function code. Client may be reading a different register than expected.

Other Reserved Values Worth Knowing

0x8000 is not the only value that carries special meaning in Modbus. The table below covers the other bit patterns that regularly appear in field data and are easy to misread as real process values.

Other Sentinel Values in Register Data

Value (hex)DecimalData type contextTypical meaning
0xFFFF65535UINT16 / INT16Common “invalid” sentinel for unsigned 16-bit points. Also equals −1 as INT16, so the same bit pattern can mean “no value” or “minus one” — check the register map for the declared type.
0x7FFF32767INT16Maximum positive INT16. Sometimes used as an overflow or out-of-range indicator, meaning the value was clamped at the upper limit.
0x80000000−2147483648INT32The 32-bit equivalent of 0x8000. Vendors use it as the invalid/sentinel value for 32-bit signed integer points spanning two registers.
0x7FC00000FLOAT32IEEE 754 quiet NaN. The standard “no value” indicator for floating-point Modbus points. Especially common on BACnet-to-Modbus gateways, which inherit BACnet’s NaN semantics.
0x7F800000FLOAT32IEEE 754 positive infinity. Occasionally used to indicate an over-range condition.
0xFF800000FLOAT32IEEE 754 negative infinity. Occasionally used to indicate an under-range condition.

If the register map notes “NaN,” “not available,” or “fault” next to a FLOAT32 point, check for 0x7FC00000 on the wire. Many Modbus clients display this as a large nonsense number rather than NaN because they decode it as a regular float.

Coil Write Values (FC05)

When writing a single coil with function code FC05, the protocol defines only two valid values:

Wire value (hex)Meaning
0xFF00ON
0x0000OFF

Any other value — including 0x0001 — is invalid per the Modbus specification. This is one of the more counterintuitive parts of the spec: writing 1 to turn a coil on does not work. The correct value is 0xFF00. Devices are permitted to reject other values with an exception response, though many silently ignore or misinterpret them. If a coil write command has no effect, verify the client is sending 0xFF00 rather than 0x0001.

If None of the Above Fits

Check the register map for these common problems:

  • Off-by-one addressing: Modbus documentation uses both zero-based (PDU) and one-based (Modicon reference) conventions. See Modbus Addressing & Register Reference.
  • Wrong function code: FC03 reads holding registers; FC04 reads input registers. Some devices are strict about which function code is used for a given register range.
  • Wrong register type: Holding registers and input registers occupy separate address spaces. Reading input register data with a holding-register request returns incorrect or invalid data.
  • Vendor documentation out of date: Register maps sometimes diverge from firmware after a product revision. Confirm the document version matches the device firmware version.