Skip to content

UY-103 · Workshop

Modbus toolkit: RTU CRC16 and float byte-order decoder

CRC16 for RTU frames and float decoding in every byte order.

CRC16 for an RTU frame

CRC (low byte first)
C5 CD
Full frame
01 03 00 00 00 0A C5 CD
Function
3 · Read Holding Registers

Encode a value to registers

ABCD4148 F5C3
CDABF5C3 4148
BADC4841 C3F5
DCBAC3F5 4841

Decode two registers to Float32 / Int32

OrderFloat32Int32UInt32
ABCD12.5600010953005471095300547
CDAB-4.950302e+32-1717531444123214152
BADC198415.812122695571212269557
DCBA-490.5645-10073353593287631937

Modbus RTU CRC16: polynomial 0xA001, initial value 0xFFFF, low byte sent first.

A Float32 spans two registers and every vendor orders them differently: ABCD (big-endian), CDAB (word swap, very common), BADC, DCBA. If a reading looks wrong, compare all four orders here.

FAQ

How do I compute the CRC of a Modbus RTU frame?

Paste the frame bytes in hex without the CRC; the tool computes it with polynomial 0xA001 and shows it in transmit order (low byte first).

I read two registers and got a nonsense number. Why?

Usually the word order differs from what you expected. Enter both register values and compare ABCD, CDAB, BADC and DCBA; the sensible value is the right order.

What is the difference between holding and input registers?

Holding registers are read/write (functions 03, 06, 16); input registers are read-only (function 04) and usually carry measurements.

Terms