×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 107248379, Entry date: 12/29/2014
(1)
Rate

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. ...

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.

  1. 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.
     
  2. 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.
     
  3. 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.
     
  4. 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".
     
  5. 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.
     
  6. 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).
     
  7. 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.
     
  8. 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.
     
  9. 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".
     
  10. 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

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.
Support to the statistics
With this function the IDs found are listed according to number (format .txt).

Generate list
Copy URL
Display page in new design
mySupport Cockpit