Protocol descriptionΒΆ

The MODBUS RTU protocol is implemented in the AC500 Processor Modules.

MODBUS is a master-slave (client-server) protocol. The client sends a request to the server(s) and receives the response(s).

The MODBUS operating mode of a serial interface is set in the PLC configuration: Setting COMx - MODBUS

MODBUS client

In this operating mode, the telegram traffic with the server(s) is handled via the Function Block COM_MOD_MAST: COM_MOD_MAST

This Function Block sends MODBUS request telegrams to the server(s) via the set interface and receives MODBUS response telegrams from the server(s) via this interface.

The MODBUS blocks transferred by the server contain the following information:

  • MODBUS address of the interrogated server (1 byte)
  • Function code that defines the request of the client (1 byte)
  • Data to be exchanged (n bytes)
  • CRC16 control code (2 bytes)

MODBUS server

In this operating mode, no Function Block is required for MODBUS communication. Sending and receiving MODBUS telegrams is performed automatically.

The AC500 CPUs process the following MODBUS operation codes:

Function code Description
DEC HEX
01 or 02 01 or 02 Read n bits
03 or 04 03 or 04 Read n words
05 05 Write one bit (encoded in one word)
06 06 Write one word
07 07 Fast reading the status byte of the CPU
15 0F Write n bits (encoded in one byte)
16 10 Write n words
22 16 Mask write
23 17 Read/write multiple words in one telegram

The following restrictions apply to the length of the data to be sent:

Function code Max. length
DEC HEX
01 or 02 01 or 02 2000 bits
03 or 04 03 or 04 125 words / 62 double words
05 05 1 bit
06 06 1 word
07 07 8 bits
15 0F 1968 bits
16 10 123 words / 61 double words
22 16 Write: 1 word
23 17

Read: 125 words / 62 double words

Write: 120 words / 60 double words