DOCA0105EN-09

Modbus Master-Slave Principle

Overview

The Modbus protocol exchanges information using a request-reply mechanism between a master (client) and a slave (server). The master-slave principle is a model for a communication protocol in which one device (the master) controls one or more other devices (the slaves). In a standard Modbus network, there is 1 master and up to 31 slaves.

A detailed description of the Modbus protocol is available at www.modbus.org.

Characteristics of the Master-Slave Principle

The master-slave principle is characterized as follows:

  • Only 1 master is connected to the network at the same time.

  • Only the master can initiate communication and send requests to the slaves.

  • The master can address each slave individually using its specific address or all slaves simultaneously using address 0.

  • The slaves can only send replies to the master.

  • The slaves cannot initiate communication, neither to the master nor to other slaves.

Master-Slave Communication Modes

The Modbus protocol can exchange information using 2 communication modes:

  • unicast mode

  • broadcast mode

Unicast Mode

In unicast mode, the master addresses a slave using the specific address of the slave. The slave processes the request then replies to the master.

1 Request

2 Process

3 Reply

Broadcast Mode

The master can also address all slaves using address 0. This type of exchange is called broadcasting. The slaves do not reply to broadcasting messages.

Response Time

The response time Tr is the time needed by a slave to respond to a request sent by the master:

Values with the Modbus protocol:

  • Typical value < 10 ms for 90% of the exchanges

  • Maximum value is around 700 ms, so it is recommended to implement a 1 second time out after sending a Modbus request.

Data Exchange

The Modbus protocol uses 2 types of data:

  • Single bit

  • Register (16 bits)

MasterPact MTZ circuit breakers support registers only.

Each register has a register number. Each type of data (bit or register) has a 16-bit address.

The messages exchanged with the Modbus protocol contain the address of the data to be processed.

Registers and Addresses

The address of register number n is n-1. The tables detailed in the following parts of this document provide both register numbers (in decimal format) and corresponding addresses (in hexadecimal format). For example, the address of register number 12000 is 0x2EDF (11999).

Frames

All the frames exchanged with the Modbus protocol have a maximum size of 256 bytes and are composed of 4 fields:

Field

Definition

Size

Description

1

Slave number

1 byte

Destination of the request

  • 0: Broadcasting (all slaves concerned)

  • 1–247: Unique destination

  • 248–255: Reserved

2

Function codes

1 byte

Refer to function codes description

3

Data

n registers

Request or reply data

4

CRC error checking

2 bytes

CRC16 (to check the content of the entire transmission message)

QR Code is a registered trademark of DENSO WAVE INCORPORATED in Japan and other countries.

Was this helpful?