Chapter 9 Deployment CPU 21xSER-1 Manual VIPA CPU 21x
9-24 HB103E - Rev. 05/45
Modbus – Example communication
The example establishes a communication between a master and a slave
via Modbus. The following combination options are shown:
Modbus master (M) Modbus slave (S)
CPU 21xSER-1 CPU 21xSER-1
CPU 21xSER-1 CP 240
The following components are required for this example:
• 2 CPU 21xSER-1 as Modbus RTU master res. Modbus RTU slave
• Siemens SIMATIC Manager and possibilities for the project transfer
• Modbus cable connection
• Assemble a Modbus system consisting of a CPU 21xSER-1 as Modbus
master and a CPU 21xSER-1 as Modbus slave and Modbus cable.
• Execute the project engineering of the master!
For this you create a PLC user application with the following structure:
OB 100: Call SFC 216 (configuration as Modbus RTU master) with
timeout setting and error evaluation.
OB 1: Call SFC 217 (SER_SND) where the data is send with error
evaluation. Here you have to build up the telegram according
to the Modbus rules.
Call SFC 218 (SER_RECV) where the data is received with
error evaluation.
• Execute the project engineering of the slave!
The PLC user application at the slave has the following structure:
OB 100: Call SFC 216 (configuration as Modbus RTU slave) with
timeout setting and Modbus address in the DB and error
evaluation.
OB 1: Call SFC 217 (SER_SND) for data transport from the slave
CPU to the output buffer.
Call SFC 218 (SER_RECV) for the data transport from the
input buffer to the CPU. Allow an according error evaluation
for both directions.
The following page shows the structure for the according PLC programs for
master and slave.
Outline
M: CPU 21xSER-1
S: CPU 21xSER-1
Approach