What should you watch out for in particular when using the "Modbus_Master", "Modbus_Slave" and "Modbus_Comm_Load" instructions with the S7-1500 CPU?
-
Entry
-
Associated product(s)
Description
If you use the "Modbus_Master", "Modbus_Slave" and "Modbus_Comm_Load" instructions, this entry can help you with commissioning and troubleshooting.
Notes on "Modbus_Master"
The notes below are supplementary to the documentation in STEP 7.
- STATUS 16#818B: The "DATA_PTR" parameter points to a DB of the "optimized" type (contrary to the instructions in the Online Help, there is no output of the STATUS 16#818C).
- If the "MB_ADDR" parameter is incorrectly supplied, errors are also output if the "REQ" input is interconnected with "false".
- If the "DATA_PTR" parameter points to a small area (a byte, for example), then the output parameters are set as follows:
DONE = true, ERROR = true, STATUS = 0 - If the requested write or read area ("DATA_ADDR" and "DATA_LEN" parameters) is greater than the permitted working area, then the request message is still sent to the Modbus slave.
Notes on "Modbus_Slave"
The notes below are supplementary to the documentation in STEP 7.
- STATUS 16#818C: The "MB_HOLD_REG" parameter points to an area which is too small (a byte, for example). (The STATUS 16#8187 is not output as incorrectly indicated in the documentation).
- The "Exception_Count" parameter from the public static tags is not incremented if a read or write job is to be made outside the area defined by "MB_HOLD_REG" or outside the limits of the input and output area.
Notes on "Modbus_Comm_Load"
In order to be able to use the Modbus_Master and Modbus_Slave instructions you must first initialize the communication module CM PtP with the "Modbus_Comm_Load" instruction.
After pulling/plugging a CM PtP module or after a break in the power supply, you must call the "Modbus_Comm_Load" instruction again at the header of the distributed IO (IM module) before calling the Modbus_Master or Modbus_Slave instructions.
To ensure error-free running of the user program you must make the following changes to your user program.
- Add the organization block OB83 ("Pull or plug of modules") to your user program to intercept the pulling/plugging of the communication module.
Fig. 01
The block is the always called again when a module of the S7 station is pulled or plugged. The call parameters transmit which module has triggered the call of the OB.
- Open the OB83 ("Pull or plug of modules").
In the user program you compare the "LADDR" parameter with the hardware identifier of your CM PtP module.
If the OB83 is triggered by a CM PtP module which communicates via "Modbus RTU", then you must manipulate the program so that the "Modbus_Comm_Load" instruction is then called to re-initialize the module.
- To trigger re-initialization you can set a marker bit, for example, (here: "DB1".Call_Modbus_Comm_Load), which is queried in your user program.
Fig. 02
As soon as the marker bit is set to "TRUE", the "Modbus_Comm_Load" instruction must be called again to initialize the modem.
- If the Modbus_Master or Modbus_Slave expects a send acknowledgment when a CM PtP module is pulled/plugged, then this wait state must be terminated. For this you set the internal parameter "MB_state" in the instance DB of the instructions as well as the parameter "SEND_PTP. y_state" for the Modbus_Slave to "0".
- Once the initialization has been executed successfully, the marker bit has to be reset again.
In the sample project in Entry ID 68202723 this query is also run in OB83.
- To intercept failure of the header module of the ET 200SP you add OB86 ("Rack or station failure") to your user program.
Fig. 03
The block is then called when there is a failure in the distributed IO station (for example: power failure).
- Open OB86 ("Rack or station failure").
In the user program you compare the "LADDR" parameter with the hardware identifier of the header station.
If the call of OB86 is triggered by the header station of the ET 200SP, then you must manipulate the program so that the "Modbus_Comm_Load" instruction is then called to re-initialize the module.
- To trigger re-initialization you can set a marker bit, for example, (here: "DB1".Call_Modbus_Comm_Load), which is queried in your user program. As soon as the marker bit is set to "TRUE", the "Modbus_Comm_Load" instruction must be called again to initialize the modem.
- If the Modbus_Master or Modbus_Slave expects a send acknowledgment when the power fails on the header of the distributed IO (IM module), then this wait state must be terminated. For this you set the internal parameter "MB_state" in the instance DB of the instructions as well as the parameter "SEND_PTP. y_state" for the "Modbus_Slave" to "0".
- Once the initialization has been executed successfully, the marker bit has to be reset again.
In the sample project in Entry ID 68202723 this query is also run in OB86.
Additional Information
Detailed information about how to use the Modbus RTU blocks for the CM PtP module and a sample project for downloading are available in Entry ID 68202723.
Additional Keywords
Modbus_Master, Modbus RTU, Modbus_Slave, Modbus_Comm_Load
- German
- Spanish
- French
- Chinese
- Italian
Entry belongs to product tree folder(s):
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 CPUs Standard-CPUs
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 CPUs Failsafe CPUs
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 I/O modules Communication CM PtP
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 Accessories
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Distributed Controller based on ET200Pro Central processing units Standard CPUs
- Automation Technology Products for specific requirements Automatision technology for extreme conditions SIPLUS extreme Industrial Automation Systems Controllers SIPLUS Advanced Controller SIPLUS S7-1500 SIPLUS Central Processing Units SIPLUS Standard CPUs
- Automation Technology Products for specific requirements Automatision technology for extreme conditions SIPLUS extreme Industrial Automation Systems Controllers SIPLUS Advanced Controller SIPLUS S7-1500 SIPLUS I/O modules SIPLUS Communication SIPLUS CM PtP
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 CPUs Compact CPUs
- Automation Technology Products for specific requirements Automatision technology for extreme conditions SIPLUS extreme Industrial Automation Systems Controllers SIPLUS Distributed Controller Based on SIPLUS ET 200SP SIPLUS Central Processing Units SIPLUS Standard CPUs
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 CPUs Technology CPUs
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Distributed Controller based on ET200Pro Central processing units Fail-safe CPUs
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC I/O systems ET 200 systems for the cabinet ET 200SP I/O Modules Communikation Modules CM PtP serial interface
- Automation Technology Automation Systems Industrial Automation Systems SIMATIC PLC Advanced Controller S7-1500 CPUs Redundante CPUs
- You have a technical question / problem: Ask the Technical Support
- You want to discuss in our forum and exchange experiences with other users
- You want to create CAx data for one or more products
- You would like to send us feedback on this Entry