MODBUS COMMANDS
The format of the commands for the read/write operations is as follows (8 byte):
Slave
address
1 byte
•
Slave address Defines the system to access. A Modbus command contains the Modbus address of the device it is
intended for (1 to 247). 0 address is reserved for a transmission to all devices (broadcast).
•
Operation code. Specifies the operation to be performed.
•
Register address. Specifies the operation to be accessed. In commands to be performed in multiple registers,
defines the boot log, from which you want to operate consecutively.
•
Data. Formed by 2 bytes (simple operations) or a set of 2 bytes (multiple operations) that contain the information
in the command.
•
CRC. Two bytes are added to the end of the stream in order to detect transmission o reception errors. This action
is done using the Cyclic Redundant Code.
Generator polynomial: CRC-16 = x
WRITE COMMANDS
Write a single holding register
The response, as long as there is no error type, must be exactly the same format as the write command.
Write multiple registers
Operation code
Register address
1 byte
1 byte
+ x
+ x
+ 1.
16
15
2
Byte
0
Address of the slave (1-247) (0: Broadcast)
1
Write single register (6)
2
Register address
3
4
Data to be written
5
6
CRC
7
Byte
0
Address of the slave (1-247) (0: Broadcast)
1
Write multiple register (16)
2
Starting register address
3
Number of registers to be written (N)
4
5
Total number of bytes of write data (2·N)
6
Data to be written in register 1
7
5+2·N
Data to be written in register N
6+2·N
7+2·N
CRC
8+2·N
Data
1...2·N bytes
Field
Field
...
CRC
2 bytes
15
ES
EN
FR
IT
PT
DE