Modbus Rtu Master Example Program - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Communication processor and Modbus TCP
12.5 Modbus communication
12.5.3.4

Modbus RTU master example program

MB_COMM_LOAD is initialized during start-up by using the first scan flag. Execution of
MB_COMM_LOAD in this manner should only be done when the serial port configuration will
not change at runtime.
Network 1 Initialize the RS485 module parameters only once during the first scan.
One MB_MASTER instruction is used in the program cycle OB to communicate with a single
slave. Additional MB_MASTER instructions can be used in the program cycle OB to
communicate with other slaves, or one MB_MASTER FB could be re-used to communicate
with additional slaves.
Network 2 Read 100 words from the slave holding register.
762
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents