MODBUS Protocol is a messaging structure developed by Modicon in 1979, used to establish master-slave/client-server communication between intelligent devices.
In Modbus communication between devices are established using a master-slave technique. The master device gives instructions to read or write data from the slave devices. Slaves respond to the instructions given by the masters.
A master can be a controller system, slaves are peripheral devices. Masters can either communicated with an individual slave or broadcast the message to all the slaves.
A Modbus master transfer data which contains information on the address of interrogated slave (1 byte, Function code that defines the request of the master (1 byte ), data to be exchanged (n byte), CRC16 control code (2 bytes).
In operating mode Modbus slave, no function block is required for Modbus communication. Sending and receiving Modbus telegram is performed automatically.
Serial transmission mode of Modbus network:
The transmission mode defines the bit contents of the message bytes transmitted along the network, and how the message information is to be packed into the message stream and decoded.
There are two standard serial transmission modes:
Data framing for both ASCII and RTU modes are shown in above figure.
ASCII transmission mode:
In ASCII (American Standard Code for Information Interchange) transmission mode each character bytes in a message is sent as 2 ASCII characters. This mode allows time intervals of up to a second between characters during transmission to distinguish characters.
Character frame for ASCII is shown in the figure. ASCII message start program with colon character “…” and end with a carriage return-line feed pair of characters (CRLF, ASCII 0DH & 0AH). ASCII Mode data 'byte’ or character is only 7 bits long.
In ASCII mode, all network devices monitor for the colon character so that they understand there is a message. And the message is decoded only at the addressed device.
RTU transmission mode:
In RTU (Remote Terminal Unit) Mode, each 8-bit message byte contains two 4-bit hexadecimal characters, and the message is transmitted in a continuous stream.
The time gap between two messages distinguishes between two messages. RTU mode messages start with a silent interval of at least 3.5 character times implemented as a multiple of character times at the baud rate being used on the network. The allowable characters transmitted for all fields are hexadecimal values 0-9, A-F.
The message is transferred continuously in a stream, there should be no interval of more than 1.5 character time. If there is an interval more than 1.5 character time than the next byte will be addressed as new message.
Modbus resources links: