Accueil > Industrial communication > MODBUS fieldbus
Industrial communication

MODBUS fieldbus

The protocol :

A protocol consists of the definition of exchange frames. Several protocols have been defined. The best known protocol is the Modbus protocol (trademark registered by MODICON) and Profibus (Siemens) which are two standard dialogue protocols based on a hierarchical structure between a master and several slaves. Mikroelectronika also offers a non-standard protocol for communicating microcontrollers such as PIC, DsPIC, AVR and Intel. However, the user is free to define his own protocol.

MODBUS protocol
  • The master sends a request and waits for a response.
  • Two slaves cannot talk to each other.
  • The master-slave dialogue can be shown schematically in a successive form of point-to-point links.
  • Communication mode: half-duplex. (2 wires or 4 wires)
  • the master talks to all the slaves, without waiting for a response (broadcast).

There can be only one device transmitting on the line. No slave can send a message without a prior request from the master. Direct dialogue between slaves is impossible.
1. Message structure :
The master sends a message consisting of the following:

Message structure
  • The end of message detection is performed on a silence of duration greater than or equal to the transmission duration of 3 bytes.
  • The slave responds with a message of the same type as the question message.

The Modbus protocol is widely used for communications of industrial programmable logic controllers and variable speed drives for electric motors.

2. Addressing

Bus subscribers are identified by addresses assigned by the user.
The address of each subscriber is independent of its physical location.
The addresses range from 1 to 64 for the Modbus protocol and from 1 to 255 in general and do not have to be assigned sequentially.
Two subscribers cannot have the same address.

3. Master to 1 slave exchange

The master interrogates a slave with a unique number on the network and waits for a response from this slave.

Master to 1 slave exchange

4. Master exchange to all slaves

The master broadcasts a message to all the slaves present on the network, they execute the order of the message without emitting a response.

Master exchange to all slaves

5. General format of a frame

Two types of coding can be used to communicate on a Modbus network.
All the devices on the network must be configured according to the same type.

  • RTU (Remote Terminal Unit) mode:

The frame does not have a message header byte or end of message bytes.
Its definition is as follows:

Remote terminal unit

CRC16: polynomial check parameter (cyclical redundancy check).
The end of frame detection is performed on a silence greater than or equal to 3 bytes.

  • ASCII mode :

Each field making up a frame is coded with 2 ASCII characters (2 times 8 bits).

ASCII mode

LRC: It is the sum in modulo 256 hexadecimal of the content of the frame excluding delimiters, complemented to 2 and transmitted in ASCII.

6. Question / answer exchange frame

The question :

It contains a function code indicating to the slave addressed what type of action is requested.
The data contains additional information that the slave needs to perform this function.
The control bytes field allows the slave to ensure that the content of the question is complete.

The answer

If an error appears, the function code is changed to indicate that the response is an error response.
The data then contains a code (exception code) allowing the type of error to be known.
The control field allows the master to confirm that the message is valid.

It may interest you

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
30 ⁄ 10 =