Modbus RTU Function 16 'Preset Multiple Registers'

To write 3 words (48 bits) to 3 consecutive registers you send the following:

Byte 0 Modbus Device Address (1 to 247)
Byte 1 Function Code / Message Type (0x10)
Byte 2 Start Register Number (high byte)
Byte 3 Start Register Number (low byte)
Byte 4 Number of registers to write(high byte)
Byte 5 Number of registers to write (low byte)
Byte 6 Number of data bytes that follow(3 registers x 2 bytes each = 6)
Byte 7 Data0
Byte 8 Data1
Byte 9 Data2​
Byte 10 Data​3
Byte 11 Data4
Byte 12 Data5
Byte 13 CRC of bytes 1 to 6 (high byte)
Byte 14 CRC of bytes 1 to 6 (low byte)

The response:

Byte 0 Modbus Device Address
Byte 1 Function Code / Message Type (0x10)
Byte 2 Start Register Number (high byte)
Byte 3 Start Register Number (low byte)
Byte 4 The number of registers written (high byte)
Byte 5 The number of registers written (low byte)
Byte 6 CRC of bytes 1 to 6 (high byte)
Byte 7 CRC of bytes 1 to 6 (low byte)

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

  1. Jorge

    3 years ago

    Check the crc byte order, first low then high

Comments

Your email address will not be published. Required fields are marked *