Modbus Slave

Modbus is an open and de facto standard communications protocol that is available in many programmable logic controllers (PLCs) and field devices for transfer of static data values using serial or IP messaging.

Modbus Object/Data Types

Data is presented in four data types, each with an address space, type, read/write mode and size.

Example – using Modbus slave to connect RTU data with a local HMI panel

This example shows RTU variables have been associated to a Modbus slave (address 1).

All four Modbus data types are used.

Modbus slave example

Modbus Slave – setup is easy

Use the fieldbus configurator to add the Modbus slave protocol, set the slave address, then create slave ‘data blocks’ for each data type eg. input bits, coil bits, input registers and holding registers. Each data block is a set of contiguous addresses – add multiple blocks of the different data types if required. Then drag the variables of interest from your list of program variables in to the appropriate data block and set their offset/position in the address list.
Modbus slave fieldbus configuration interface

Modbus Slave – standard serial or IP setup

If using TCP/IP then nothing needs to be added – by default the RTU listens on port 502 for Modbus messages.

If using serial comms, then a listening port is defined using the MBSLAVERTU function block. This block has three inputs, enable, port eg. ‘COM1:9600,N,8,1’ and slave address eg. 1.

Modbus Slave – advanced setup with function blocks in the logic application

In some applications the RTU may be required to act as multiple slave devices to one or Modbus masters. The WorkSuite logic editor includes additional function blocks that allow management of multiple Modbus slave ‘sessions’ eg. multiple server instances.

Click on an icon below to find out more about a particular protocol or driver.

Subscribe

* indicates required