Note
Setting the maximum record length for PROFIBUS communication
When using a CM1243-5 PROFIBUS Master module to control an ET 200SP or ET 200MP
PROFIBUS device that uses an RS232, RS422, or RS485 point-to-point module, you need
to explicitly set the "max_record_len" data block tag to 240 as defined below:
Set "max_record_len" in the Send_P2P section of the instance DB (for example,
"Modbus_Slave_DB".Send_P2P.max_record_len) to 240 after running Modbus_Comm_Load.
Explicitly assigning max_record_len is only necessary with PROFIBUS communication;
PROFINET communication already uses a valid max_record_len value.
13.5.3.5
Modbus RTU examples
Example: Modbus RTU master program
Modbus_Comm_Load is initialized during start-up by using the first scan flag. Execution of
Modbus_Comm_Load in this manner should only be done when the serial port configuration
will not change at runtime.
Network 1: Configure/initialize the RS485 module communications port only once during the
first scan.
One Modbus_Master instruction is used in the program cycle OB to communicate with a
single slave. Additional Modbus_Master instructions can be used in the program cycle OB to
communicate with other slaves, or one Modbus_Master FB could be re-used to communicate
with additional slaves.
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
Communication processor and Modbus TCP
13.5 Modbus communication
1213