MODBUS© Protocol is a messaging structure, widely used for master-slave communication between devices.

Only one master (at the same time) is connected to the bus, and one or several (247 maximum number) slaves nodes are also connected to the same serial bus.

When a MODBUS master wants information from a device, the master sends a message that contains the device’s address, data it wants, and a checksum for error detection. Every other device on the network sees the message, but only the device that is addressed responds.


There are two types of master requests:

  • Unicast mode
  • Broadcast mode


Fig. 1 Master - Slave communication in MODBUS

Fig. 1 Master – Slave communication in MODBUS


Fig. 2 Modbus OSI model

Fig. 2 Modbus OSI model

There are three popular MODBUS versions:
All MODBUS messages are sent in the same format.

Fig. 3 Modbus Frame

Fig. 3 Modbus Frame

The only difference among the three MODBUS types is in how the messages are coded.

A master addresses a slave by placing the slave address in the address field of the message. When the slave returns its response, it places its own address in the response address field to let the master know which slave is responding.

MODBUS has up to 255 function codes


In ASCII mode each byte in a message is sent as two ASCII characters.

Example : The byte 0X5B is encoded as two characters : 0x35 and 0x42 ( 0x35 =”5″, and 0x42 =”B” in ASCII ).

The serial transmission consist of the following bits:

  • 1 start bit
  • 7 data bits, least significant bit sent first (A 7-bit data is more efficient than 8, when transferring 7-bit ASCII characters).
  • 1 bit for parity check (even parity by default)
  • 1 stop bit

For example the character “:” is sent as :

ASCII char Hex Binary
: 3A 111010
Fig. 3 Serial transmission of ":" ASCII char

Fig. 3 Serial transmission of “:” ASCII char


Fig. 4 MODBUS ASCII frame

Fig. 4 MODBUS ASCII frame

In ASCII mode, a message is delimited by specific characters as Start-of-frames and End-of-frames. A message must start with a ‘colon’ ( : ) character (ASCII 3A hex), and end with a ‘carriage return – line feed’ (CRLF) pair (ASCII 0D and 0A hex).
The allowable characters transmitted for all other fields are hexadecimal 0–9, A–F (ASCII coded). The devices monitor the bus continuously for the ‘colon’ character. When this character is received, each device decodes the next character until it detects the End-Of-Frame.

Was this article helpful?