Modbus is a communication protocol for the exchange of messages between intelligent Modbus controllers, independent of the network structure. The Modbus protocol is located on the application layer of the OSI reference model and supports master- slave operation between intelligent devices.
The Modbus protocol defines the message type used by the master station, which is independent of the networks over which Modbus controllers communicate with each other. It describes how a Modbus controller accesses another controller via a request, how the controller responds to the request, and how errors are detected and documented. The Modbus protocol works on a request- response basis and provides various services that are specified by function codes. During communication, the Modbus protocol determines how each controller learns the device address and recognizes messages intended for it. It also determines the actions to be triggered and what information the Modbus controller can take from the message flow. If a response is required, then it is built up in the controller and sent to the appropriate station using the Modbus protocol.
Since the Modbus protocol can also be encapsulated in other frames, the Modbus has also tapped into industrial Ethernet and has the reserved port number 502 in the TCP/ IP protocol stack. The Modbus protocol for Ethernet/IP is called Modbus-TCP.
For the master-slave operation there is the telemetry protocol Modbus- RTU, Remote Terminal Unit. The Modbus RTU slave can work with the Modbus master in the same way as the Modbus master works with the slave. The functions that support Modbus-RTU include status messages about the state of the relay coil and its input state, reading of the hold and output registers, actuation of one or more relay coils.