PLCBytes
Modbus tools

Modbus Value Encoder

Enter the value you want to send and pick the data type. You get the registers for every byte order in hex and decimal, plus the frame that writes them.

Value

Example
Scaling

As in the register map: the device value is the register divided by this number. Integer types only.

Registers

OrderHexDecimalBytes

Write request

The frame a master sends to write these registers: function 06 for one register, 16 for more.

Modbus RTU (CRC low byte first)
Modbus TCP (transaction 1)

Runs entirely in your browser. Nothing you enter is sent to a server.

Data types at a glance

TypeRegistersRange
UInt1610 … 65535
Int161−32768 … 32767
UInt3220 … 4294967295
Int322−2147483648 … 2147483647
Float322±3.4e38, ~7 digits
UInt6440 … 18446744073709551615
Int644−9223372036854775808 … 9223372036854775807
Float644±1.8e308, ~15 digits

How it works

A Modbus register holds 16 bits. Larger values are split into bytes and spread over two or four registers, and the device decides in which order. The encoder builds the bytes of your value and shows them in all four orders. Pick the row your device expects; if you are not sure, read a known value first with the register decoder and use the same order for writing.

Integer types with scaling work the way register maps describe them. A setpoint of 230.5 V with “÷10” is sent as 2305. The calculation is done in exact decimal, so 230.55 ÷10 is rounded to 2306 and you are told about it.

Common mistakes

Questions from practice

How do I write a float to a Modbus register?

Choose Float32, type the value and pick the byte order your device uses. Write both registers at once with function 16, starting at the first register of the pair. The Write request panel shows the complete frame.

Why does 0.1 become 0.100000001?

Float32 stores numbers in binary with about 7 significant digits, and 0.1 has no exact binary form. The nearest value it can hold is 0.100000001. Devices show it as 0.1, so this is normal. Use Float64 or a scaled integer if you need exact decimals.

How are negative numbers stored?

Signed types use two's complement. -1 is FFFF in Int16 and FFFF FFFF in Int32; -10 with scaling ÷10 is -100, which is FF9C. If the register map says UInt16, the device cannot take negative values at all.

Should I use function 06 or 16?

Function 06 writes exactly one register. Function 16 writes one or more registers in a single request, which is required for 32- and 64-bit values. Some devices only accept function 16, even for a single register; the manual usually says so.

What does scaling ÷10 mean here?

It is the same scaling the register map gives for reading: the device value is the register divided by 10. To write 230.5, the encoder sends 2305. ÷100 and ÷1000 work the same way.

Related tools