Modbus RTU Function 06 'Preset Single Register'

To write a word (16 bits) to a register you send the following:

Byte 0 Modbus Device Address (1 to 247)
Byte 1 Function Code / Message Type (0x06)
Byte 2 Register Number (high byte)
Byte 3 Register Number (low byte)
Byte 4 Data0
Byte 5 Data1
Byte 6 CRC of bytes 1 to 6 (high byte)
Byte 7 CRC of bytes 1 to 6 (low byte)

The response is a copy of what was sent

Byte 0 Modbus Device Address
Byte 1 Function Code / Message Type (0x06)
Byte 2 Register Number (high byte)
Byte 3 Register Number (low byte)
Byte 4 Data0
Byte 5 Data1
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.