Libraries
9.3 Modbus RTU library
S7-200 SMART
494
System Manual, V2.3, 07/2017, A5E03822230-AF
9.3.4
Modbus RTU master example program
This example program shows how to use the Modbus Master instructions to write and read
four holding registers to and from a Modbus slave each time input I0.0 turns on.
The CPU writes four words starting at VW100 to the holding registers of the Modbus slave
starting at address 40001.
The CPU then reads four holding registers from 40010 to 40013 from the Modbus slave and
places the data into the V memory of the CPU starting at VW200.
This example uses a single master and the MBUS_CTRL and MBUS_MSG instructions. The
same concepts apply to examples with a second master and the MB_CTRL2 and MB_MSG2
instructions.
Figure 9-1
Example Program Data Transfers