What are the function codes of Modbus (RTU)and their requests and responses?
Today, we are going to see few basic functions of Modbus registers like how to write data to a register and read the data from the register using the functional codes. This is the communication between a Modbus master and its slaves.
Basically, when you start working on the Industrial standard communication protocol like Modbus for the first time, this will give you a detail understanding of how things work and how to start working on Modbus from scratch.
Introduction:
To have a Quick intro, Modbus protocol is defined as a master/slave protocol, meaning a device operating as a master will poll one or more devices operating as a slave.
- The most commonly used form of Modbus protocol is RTU over RS-485.
- A Modbus RTU network has one Master and one or more Slaves. Each slave has a unique 8-bit device address or unit number.
The general outline of each request and response is shown as below:
The Modbus RTU message consists of the address of the SlaveID device/Device Address, the function code, the special data, depending on the function code and the CRC of the checksum.