Sei sulla pagina 1di 45

MODBUS / TCP

Communication with
SIMOCODE pro
Siemens
SIMOCODE pro, RUGGEDCOM Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109760347 Support
Legal information

Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-
binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.

Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
 Siemens AG 2018 All rights reserved

foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.

Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.

Security information
Siemens provides products and solutions with industrial security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary
to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.
Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the Internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: https://www.siemens.com/industrialsecurity.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 2
Table of contents

Table of contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Principle of operation............................................................................ 6
1.2.1 Modbus communication protocol ......................................................... 6
1.2.2 Gateway ............................................................................................... 7
1.2.3 Role distribution .................................................................................... 8
1.2.4 Principle of the application example ................................................... 10
1.3 Components used .............................................................................. 13
2 Engineering ...................................................................................................... 14
2.1 Hardware configuration ...................................................................... 14
2.1.1 Assembly of the hardware .................................................................. 14
2.1.2 Networking the hardware ................................................................... 15
2.1.3 Addressing hardware ......................................................................... 17
2.2 Configuration ...................................................................................... 18
2.2.1 Preparation ......................................................................................... 18
2.2.2 Configuring SIMOCODE as a Modbus RTU slave ............................. 19
2.2.3 Configuring SIMATIC as Modbus TCP client ..................................... 21
2.2.4 Configuring RMC30 as a gateway ..................................................... 26
2.2.5 Downloading modules ........................................................................ 42
2.3 Operation ............................................................................................ 43
 Siemens AG 2018 All rights reserved

3 Appendix .......................................................................................................... 44
3.1 Service and Support ........................................................................... 44
3.2 Links and Literature ............................................................................ 45
3.3 Change documentation ...................................................................... 45

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 3
1 Introduction

1 Introduction
1.1 Overview
Reason
The SIMOCODE pro motor management system is used in various sectors of the
process industry for the protection, monitoring and control of motors.
SIMOCODE pro enables a standardized integration of the motor feeder in
superordinate automation systems via the integrated interface. Depending on the
version, SIMOCODE pro communicates with the automation level via PROFIBUS
or PROFINET, via Modbus RTU, EtherNet/IP or OPC UA. However, other
communication protocols can also be integrated.
In order to meet customer requirements for Modbus TCP communication,
transparent gateway solutions are available, which can realize a protocol
conversion.

Requirement
The application example is intended to show the required configuration steps for
how you can establish a connection from a controller with Modbus TCP to a motor
management device with Modbus RTU communication.
The use of a communication processor (CP) is to be dispensed with at the control
end.
 Siemens AG 2018 All rights reserved

All initiatives. e.g. connection setup, read and write jobs, are to be realized from the
controller.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 4
1 Introduction

Applicative implementation
An additional hardware component is necessary to enable communication between
a Modbus TCP network and a Modbus RTU network. The additional hardware
component is a gateway, which transparently converts Modbus TCP protocol to
Modbus RTU. The RUGGEDCOM RMC30 is used as a gateway.
SIMATIC S7-1500 is typically used as a controller in the Modbus TCP network.
Two SIMOCODE pro V MR devices are implemented as field devices in the
Modbus RTU.
Figure 1-1

SIMATIC
RUGGEDCOM
S7-1500
RMC30
 Siemens AG 2018 All rights reserved

SIMOCODE
pro V MR

Note The focus of the configuration description is on configuration of the RMC30. In


the case of SIMATIC and SIMOCODE, the necessary configuration steps and
addressed with reference to existing documentation.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 5
1 Introduction

1.2 Principle of operation


This chapter provides basic information that is important for understanding the
application example.
1.2.1 Modbus communication protocol

The Modbus protocol is a communication protocol based on a master/ slave or


client/ server model. Each bus node must have a unique address.
Modbus has two versions for the data transmission:
 Modbus RTU for the serial interface (standard RS232 and RS485)
 Modbus TCP for Ethernet.

Modbus RTU
Modbus RTU (Remote Terminal Unit) is a standard protocol for communication in
the network using the electrical RS232 or RS422/485 connection for the serial data
transmission between the Modbus devices in the network.
Modbus RTU uses a master/ slave architecture. In a master/ slave structure, the
entire communication is triggered by a sole master device, while the slaves can
only respond to the request by the master.
To enable a master/ slave communication to occur, the identical serial
communication parameters, e.g. baud rate, must be set in all subscribers. All
 Siemens AG 2018 All rights reserved

slaves require a unique device address (slave ID).

Note In this application example, the Modbus RTU is operated via an RS485 interface.

Modbus TCP
Modbus TCP is a standard protocol for communication in the network using an
Ethernet-based data transmission between the Modbus devices in the network.
TCP port 502 is reserved for Modbus TCP.
The architecture of Modbus TCP is based on a client/ server structure. The
Modbus TCP server processes a request by the Modbus TCP client and
acknowledges the request with a success message or error message.
To enable client/ server communication to occur, all subscribers must be in the
same IP subnet. An additional setting is made via the device address. The device
address lets you reach the subsequent Modbus RTU slaves via a "Modbus TCP to
Modbus RTU" gateway.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 6
1 Introduction

1.2.2 Gateway

A gateway is an active network node, which can connect two incompatible nodes to
each other.

Tasks of a gateway
Gateways have the task of reconciling two networks that use different protocols.
To reconcile the different networks, the gateway is located as a link between the
incompatible networks. For this, the gateway has its own interface for each network
connected to it and can be addressed from both sides.
To enable communication between the two networks, the gateway converts the
protocol of one network side to the protocol of the other network side. The protocol
conversion occurs independently and is transparent for the other network
subscribers.
During the transition between two networks, the gateway considers the specific
conditions of both transmission systems and the transmission media, e.g. protocol.
Addressing, baud rate.

RUGGEDCOM RMC30
The RUGGEDCOM RMC30 is a serial-to-Ethernet server with two ports, which has
been developed specially for operation in electrically tough and climatically
demanding climates. The RUGGEDCOM RMC30 enables communication with a
serial device, thereby providing simple and reliable network connectivity.
 Siemens AG 2018 All rights reserved

The RUGGEDCOM RMC30 is a reliable protocol converter proven in practice. You


can use the RUGGEDCOM RMC30 to integrate the serial Modbus RTU devices
(RS-232/422/485) in a Modbus TCP network. No changes need to be made to the
serial device for this.
Figure 1-2

The RUGGEDCOM RMC30 is distinguished by the following features in particular:


 Transmission of serial data via an IP network
 Support for the serial protocols Modbus TCP, DNP 3, TIN
 Baud rates of up to 230 kbit/s
 Conversion from Modbus RTU to Modbus TCP
 Support for diverse Modbus masters
 Management interfaces: Web-based, Telnet, command line

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 7
1 Introduction

1.2.3 Role distribution

To establish functional communication between SIMATIC and SIMOCODE, it is


important that a defined role is assigned to each module.

Role of the CPU


All requests and the connection setup are to be initiated from the controller. To
enable the controller to respond actively, the controller is configured as a
"Modbus TCP client".

Roles of the SIMOCODE devices


The SIMOCODE pro devices are to respond to requests by the CPU. The two
SIMOCODE devices assume the role of "Modbus RTU slaves".

Role of the RUGGEDCOM gateway


RUGGEDCOM RMC30 is the core of this application and is the interface between
the Modbus TCP network and the Modbus RTU network. The module must
therefore assume a dual role:
 Modbus TCP server on Modbus TCP side
 Modbus RTU master on Modbus RTU side

Role distribution from a device viewpoint


 Siemens AG 2018 All rights reserved

The protocol conversion from Modbus TCP to Modbus RTU (and vice versa) by the
RUGGEDCOM RMC30 progresses transparently for the subscribers in the
Modbus TCP network and Modbus RTU network.
The following graphic shows the role distribution from a CPU perspective:
Figure 1-3

Modbus TCP server


S7-1500
(Modbus TCP client) RMC30

Modbus TCP

SIMOCODE pro

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 8
1 Introduction

The following graphic shows the role distribution from a SIMOCODE perspective:
Figure 1-4

S7-1500
RMC30

Modbus RTU Modbus RTU master

SIMOCODE pro
(Modbus RTU slaves)
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 9
1 Introduction

1.2.4 Principle of the application example

The following figures illustrate the application example in theory and practice. This
is followed by a more precise description of what is illustrated. This description
builds on the insights gained from previous chapters.

Principle of operation in theory


In the previous chapter you learned that the protocol conversion by the
RUGGEDCOM RMC30 is transparent for all devices involved.
The following figure illustrates the theoretical principle of operation behind the
application example:
Figure 1-5

4 1
Controller
Response Request

Device address Device address

Field
device
 Siemens AG 2018 All rights reserved

3 2

The numbers in the figure have the following meaning:


Table 1-1
No. Description
1. The controller sends a request, e.g. read a register, to the field device. The
request contains the device address of the field device.
2. Via the device address in the request, the field device recognizes that the
request is directed to its and receives the telegram.
3. The field device processes the request and sends a response telegram back to
the controller.
4. The controller receives the response telegram. The device address contained in
it allows the controller to assign the response telegram to the request sent.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 10
1 Introduction

Principle of operation in practice


As different network protocols are used in the application example, there is no
direct connection between the controller and field devices in reality. The
RUGGEDCOM RMC30 functions as a link.
The following figure illustrates the principle of operation behind the application
example: To make figure clearer, the response back by the field device is omitted.
The response by the field devices is the same in the opposite direction.
Figure 1-6
Automation level

TCP client

Controller
Modbus

3
Modbus TCP

Modbus
TCP
1 Request to slave 1
Target addresses:
TCP server

IP address: Gateway,
Modbus

slave ID: 1
 Siemens AG 2018 All rights reserved

Gateway 4
RTU master

Modbus
Modbus

RTU
Modbus RTU

Request to slave 1
Field level

Target addresses:
Slave ID: 1
RTU slaves

2
Modbus

Field device Field device


Slave ID 1 Slave ID 2

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 11
1 Introduction

The numbers in the figure have the following meaning:


Table 1-2
No. Description
1. As a Modbus TCP client, the controller initializes a TCP connection to the
gateway (Modbus TCP server).
2. The gateway (Modbus RTU master) is connected to the field devices (Modbus
RTU slaves).
3. The controller wants to make a request to the field device with device address 1.
It sends the request to the Modbus TCP server and added the information about
the device address (Slave ID: 1) to the request telegram.
4. The gateway receives the request from the Modbus TCP network. The gateway
converts the request to Modbus RTU and sends the request to the connected
Modbus RTU network.
5. Via the device address in the request, the field device recognizes that the
request is directed to its and receives the telegram.
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 12
1 Introduction

1.3 Components used


The following products are used in this application example:

Software packages
The software packages STEP 7 Professional V15 Update 3 and SIMOCODE ES
V15 Standard are required for this solution.
The command line interface is used to configure RUGGEDCOM. To use the
command line interface, you need a Telnet client, e.g. PuTTY (available as a free
download in the Internet).
Install these software packages on a programming device.

Required devices/components:
Use the following components for the setup:
 1x CPU 1513 (from FW V2.5) (article number: 6ES7513-1AL01-0AB0) with a
SIMATIC MEMORY CARD.
 A 24 V power supply with cable connector and terminal block plug.
 2 x SIMOCODE pro V MR basic devices (article number: 3UF7012-1AB00-0).
 1 x RUGGEDCOM RMC30 (article number: 6GK6003-0AC21-0AA0).
 Top hat rails with mounting material for SIMOCODE and SIMATIC.
 Siemens AG 2018 All rights reserved

 1x programming device on which the required software packages are installed.


 the required network cables, TP cable (twisted pair) complying with the IE FC
RJ45 standard for Industrial Ethernet.
 The required RS485 cables and plug-in connectors.
 SIRIUS USB PC cable (article number: 3UF7941-0AA00-0).

SIRIUS USB PC cable


The SIRIUS USB PC cable is used to download the configuration to SIMOCODE
pro V MR. To enable your programming device to communicate with the
SIMOCODE device via the USB PC cable, you must first installed the associated
driver. You can find the download and installation instructions in the SIEMENS
Industry Online Support (see \3\ in Chapter 3.2).

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 13
2 Engineering

2 Engineering
2.1 Hardware configuration
2.1.1 Assembly of the hardware

The following graphic shows which components were used to set up this
application example.
Figure 2-1

SIMATIC Engineering progr. dev.


S7-1500

RUGGEDCOM
 Siemens AG 2018 All rights reserved

RMC30

1.SIMOCODE 2.SIMOCODE
pro V MR pro V MR

Other / Inactive

Other / Inactive

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 14
2 Engineering

2.1.2 Networking the hardware

To connect several Modbus RTU slaves in the Modbus RTU network, the standard
RS485 is used in the serial RTU network.
If the Modbus is operated via a RS485 connection, all subscribers are clamped on
the same bus line. In this case, data line A (positive) and data line B (negative) are
differentiated. The bus must be terminated at the end with a resistor between the
tow data lines.

Required cables und plug-in connectors


SIMOCODE supports Modbus RTU with RS485. The electrical connection of the
communication interface is realized as a nine-pole SUB-D socket or as terminal
connection.
The RUGGEDCOM RMC30 is provided with a Phoenix plug-in connector with
seven connections. An RS232 connection and an RS485/422 connection can be
accommodated at this plug-in connector.
PROFIBUS cables were used in the application example and, for the connection to
the SIMOCODE pro V MR basic device, PROFIBUS connectors with integrated
terminating resistor.
The following wire assignment applies for the PROFIBUS cable:
 Green wire: -RxD/TxD (send / receive data; data line A)
 Red wire: + RxD/TxD (send / receive data; data line B)
 Siemens AG 2018 All rights reserved

Note If you do not use a PROFIBUS connector, make sure you provide a bus
termination n the last field device of the Modbus RTU network. If you use
PROFIBUS connectors, you can then utilize the connectable resistors in the
PROFIBUS connectors.

RUGGEDCOM RMC30 connection


The pin assignment for the serial connection on the RUGGEDCOM RMC30 for a
RS485 connection is defined as follows:
 PIN3: COM (common line)
 PIN4: -RxD/TxD (send / receive data; data line A)
 PIN5: + RxD/TxD (send / receive data; data line B)

Connect the PROFIBUS cable with the open and stripped end as follows to the
serial connection of the RMC30:
 PIN3: Neutral conductor
 PIN4: Green wire of the PROFIBUS cable (data line A)
 PIN5: Red wire of the PROFIBUS cable (data line B)
The RUGGEDCOM RMC30 has integrated pull-up and pull-down resistors.

Additional information
You can find more detailed information on the properties and the technical data of
the passive components and on plug-in connectors in the PROFIBUS Network
Manual (see \5\ in Chapter 3.2).

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 15
2 Engineering

Graphic view of the networking


The following graphic shows,
 how to connect the devices to one another.
 which PROFIBUS bus connection connectors you can use.
 at what pint a bus termination is necessary.
Figure 2-2

Engineering progr. dev. S7-1500

RJ45
connection
RMC30
 Siemens AG 2018 All rights reserved

Open end
Stripped PROFIBUS
cable with wire pair:
Green/red

SIMOCODE pro V MR

PROFIBUS connector PROFIBUS connector


Type:6ES7 972-0Bx52 Type:6ES7 972-0Bx52
Terminating resistor:OFF Terminating resistor:ON

Connecting the SIRIUS cable


Connect your programming device via the SIRIUS USB PC cable to a free
SIMOCODE system interface.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 16
2 Engineering

2.1.3 Addressing hardware

IP addresses and slave IDs


You only configure SIMATIC and SIMOCODE in the TIA Portal. Configure
RUGGEDCOM RMC30 via a console connection or via its web frontend.
It is helpful for the configuration if you adapt the IP addresses of the SIMATIC-CPU
and RUGGEDCOM RMC30 in advance corresponding to Table 2-1.
To assign an IP address to the CPU, you can typically use the STEP 7 function
"Edit Ethernet subscriber…" ("Accessible nodes…") or the Primary Setup Tool
(PST).
To assign an IP address to the RUGGEDCOM device, you can use the
RUGGEDCOM Explorer (see \4\ in Chapter 3.2).
Upon delivery, the RUGGEDCOM RMC30 has the IP address 192.168.0.1.
Transfer the slave ID for the two SIMOCODE devices together with the
configuration data from the TIA Portal.
The following table shows the addresses which this application example works
with:
Table 2-1
Module Address Subnet mask
SIMATIC CPU IP: 173.16.1.78
RMC30 IP: 173.16.1.77 255.255.255.0
 Siemens AG 2018 All rights reserved

Programming device IP: 173.16.1.100


1. SIMOCODE pro V MR Slave.ID: 1 -
2. SIMOCODE pro V MR Slave.ID: 2 -

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 17
2 Engineering

2.2 Configuration
2.2.1 Preparation

Creating a TIA Portal project


Create a new project with the configuration software TIA V15. Create a hardware
configuration with the SIMOCODE pro devices you use.
If you use a SIMATIC as a CPU, you also need to add this device to your STEP 7
project.
Assign an IP address to the CPU corresponding to Table 2-1.

Result
You can find a dedicated project folder for each connected device in the project
view of the TIA Portal.
Figure 2-3
 Siemens AG 2018 All rights reserved

Note If you add a device from the hardware catalog to the project in the TIA Portal, a
default parameterization will be created. This will be used in the following
instructions. Parameters and settings that must not be changed from the default
values for this application example remain are omitted below.

Note If you do not use a SIMATIC as a CPU, then assign parameters to your CPU
with the corresponding engineering tool.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 18
2 Engineering

2.2.2 Configuring SIMOCODE as a Modbus RTU slave

To integrate SIMOCODE in the Modbus RTU network, the following settings are
necessary as a minimum:
 Set slave ID
 Define serial communication parameters

Note The following instruction shows you, taking the first SIMOCODE device as an
example, how to configure the SIMOCODE as a Modbus RTU slave.
Also configure the second SIMOCODE device as shown.

Setting the slave ID


Each slave in the Modbus RTU network can be addressed via a unique device
address (slave ID).
Follow these steps to assign a slave ID to SIMOCODE:
1. Open the device folder in the project navigation and double click on
“Parameters". Select the category "Modbus".
Figure 2-4
 Siemens AG 2018 All rights reserved

2. Enter the slave ID in the mask "Modbus address" corresponding to Table 2-1.
Figure 2-5

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 19
2 Engineering

Defining the Modbus protocol


Modbus RTU is a serial protocol. To establish functional serial communication
between the RMC30 and SIMOCODE, you need to set the communication
parameters of the serial interface identically for all devices in the Modbus RTU
network. The communication parameters include the baud rate, parity and stop
bits.
Set the communication parameters of the serial interface of SIMOCODE to the
following values, or check these:
 Baud rate: 57.6 kbits/s
 Connection configuration: 8N1 – 1 stop bit, no parity
 Use standard value for wait time
 No watchdog
Figure 2-6
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 20
2 Engineering

2.2.3 Configuring SIMATIC as Modbus TCP client

System instruction "MB_CLIENT"


To operate a SIMATIC as a Modbus TCP client, you need the "MB_CLIENT"
system instruction from the TIA Portal library.
The "MB_CLIENT" system instruction communicates via the PROFINET
connection as a Modbus TCP client.
Use the "MB_CLIENT" system instruction
 to establish a connection between the TCP client and TCP server,
 send Modbus requests
 receive responses
 control the connection setup of the Modbus TCP client.

Library path
You can find the system instruction in the task card "Instructions" and here in the
category "Communications > Others > MODBUS TCP".
Figure 2-7
 Siemens AG 2018 All rights reserved

Note To view the "Instructions" task card, select the folder "Program blocks" in the
project navigation for the CUP and open a module in the folder, e.g. Main (OB1),
by double clicking.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 21
2 Engineering

Calling up the "MB_CLIENT"


Add the "MB_CLIENT" system instruction to your program and define an instance
data module.
Figure 2-8

Interface description
The table below describes the input and output parameters of the "MB_CLIENT"
system instruction:
Table 2-2
Parameter Declaration Data type Description
 Siemens AG 2018 All rights reserved

REQ Input BOOL Modbus request to the Modbus TCP


server. As long as the input REQ is set,
the system instruction sends
communication requests.
DISCONNECT Input BOOL Control connection setup and
termination to the Modbus TCP server.
 false: Establish communication
connection to the connection
partner configured at the
CONNECT parameter
 true: Disconnect communication
connection.
MB_MODE Input USINT Selection of the Modbus request (read,
write or diagnosis) or direct selection of
a Modbus function.
MB_DATA_ADDR Input UDINT Information about what is to be read or
written, as well as address information
from which the "MB_CLIENT" system
instruction calculates the remote
address; depending on the
"MB_MODE" parameter
MB_DATA_LEN Input UINT Data length: Number of bits or words
for the data access.
MB_DATA_PTR InOut VARIANT Pointer to a data buffer for the Modbus
server for data to be received from or
sent to the Modbus server.
CONNECT Inout VARIANT Pointer to the structure of the
connection description.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 22
2 Engineering

Parameter Declaration Data type Description


DONE Output BOOL Status display; if true the last Modbus
request is executed without error.
BUSY Output BOOL Processing display; if true a Modbus
request is processed.
ERROR Output BOOL Error display; if true an error has
occurred. The cause of the error is
indicated via the STATUS parameter.
STATUS Output WORD Detailed status information for the
system instruction.

Note You can find further information on the "MB_CLIENT" system instruction in the
Online Help in the TIA Portal.

Static variable "MB_Unit_ID" of the system instruction


The Modbus device address (slave ID) is saved in the static variable "MB_Unit_ID".
If you have set up a pure Modbus TCP network (without protocol conversion), the
Modbus TCP server is addressed via its IP address. The static variable
"MB_Unit_ID" is used for the pure Modbus TCP communication.
 Siemens AG 2018 All rights reserved

If the Modbus TCP server is a gateway, the Modbus RTU slave can be identified
via its slave ID. The Modbus TCP client sends the requests directly to the Modbus
TCP server, and the Modbus TCP server forwards the requests to the slave device,
which is addressed via the "MB_Unit_ID" parameter.
In this application example, the RUGGEDCOM RMC30 converts the Modbus TCP
protocol to Modbus RTU. In order to identify the Modbus RTU slaves uniquely, the
S7-CPU must also send the device address for its request as a Modbus TCP client.

Note If you make a request to a Modbus RTU slave with the S7-CPU as a Modbus
TCP client, you must then enter the slave ID of the Modbus RTU slave to which
the request is made in the "MB_Unit_ID" parameter.
Example:
You intend to make a request to the 2. SIMOCODE pro V MR (Slave-ID: 2). In
this case, enter the value "2" in the static variable and trigger the "MB_CLIENT"
system instruction with REQ = true.

Note You can find further information on the "MB_Unit_ID" parameter in the Siemens
Industry Online Support (see \6\ in Chapter 3.2).

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 23
2 Engineering

MB_CLIENT parameter assignment


The controller is a Modbus TCP client and initializes the connection setup. All
requests to the SIMOCODE devices are triggered via the CPU.
To demonstrate the communication between the CPU and SIMOCODE, the
variable "ORDER_ID" from the "I&M0 device identification" is read out of the
SIMOCODEs in this application example. The "ORDER_ID" variable can be
accessed via the address W#16#4006.
Access to the I&M0 device identification is only possible as read-only access via
function codes 03 and 04. The data length of the "ORDER_ID" variable is 20 bytes.

Note You can fund an overview with all Modbus data tables for SIMOCODE in the
Function Manual SIMOCODE pro (see \7\ in Chapter 3.2).

Assign parameters to the "MB_CLIENT" system instruction. The following table


shows which parameters you have to set as a minimum. Save and then compile
the TIA project.
Table 2-3
Parameter Assignment
REQ Link this variable to a flat bit.
DISCONNECT Link this variable to a flat bit.
MB_MODE Function code for the Modbus request. Set the variable with
the value "104" for this application example.
 Siemens AG 2018 All rights reserved

MB_DATA_ADDR Information about what is to be read or written. Set the


variable with the value "16390" (W#16#4006) for this
application example.
MB_DATA_LEN Data length. Set the variable with the value "20" for this
application example.
MB_DATA_PTR Pointer to a data buffer for the Modbus server for data to be
received from the Modbus server. Define a variable of the type
Array[0..20] of Byte in a global data module for this. Set the
"MB_DATA_PTR" variable with the variable from the data
module.
CONNECT Pointer to the structure of the connection description. Define a
variable of the type "TCON_IP_V4" in a global data module for
this and assign parameters to the variables of the data type as
follows:
 interface_id: Hardware ID of the interface
 id: Connection number
 connection_type: 11
 active_established: true
 remote_address: 173.16.1.77
 remote_port: 502
 local_port: Local port number
Set the "CONNECT" variable with the variable from the data
module.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 24
2 Engineering

The figure below shows the interconnection of the system instruction.


Figure 2-9

The figure below illustrates how a global data module for the variables
"MB_DATA_PTR" and "CONNECT" can look:
Figure 2-10
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 25
2 Engineering

2.2.4 Configuring RMC30 as a gateway

Required steps
 Set serial interface
 Configure Modbus TCP server
 Define device addresses

Configuration options
You have two options to configure the gateway:
 via a console interface
Figure 2-11
 Siemens AG 2018 All rights reserved

 via a web interface


Figure 2-12

Configuration via the console interface is described below.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 26
2 Engineering

Configuration tool PuTTY


The SSH protocol is required to configure RUGGEDCOM RMC30 via the
command line interface. The "PuTTY" software freely available in the Internet is
used as a Telnet client in this application example.
Once you have entered the IP address of RUGGEDCOM in PuTTY, PuTTY then
establishes a console connection to the RUGGEDCOM, and you can access the
device directly by command line.
The following table lists the most important keyboard shortcuts that you need for
configuration with PuTTY:
Table 2-4
Function Keyboard shortcut
Save settings <CTRL> A
Navigate Arrow key
Quit menu <ESC>
Select entry from selection list Arrow key up/ down
Apply selection <Enter>
Add new table line <CTRL> I
Delete table entry <CTRL> L
Log out <CTRL> X
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 27
2 Engineering

Establishing the connection


Follow these steps to establish an SSH connection to the RUGGEDCOM:
1. Open the PuTTY tool and enter the IP address of the RMC30 (here:
173.16.1.77). Then click the "Open" button.
Figure 2-13
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 28
2 Engineering

2. An empty console window opens. Press the <Enter> key on your keyboard or
wait until the login entry appears in the output window.
Figure 2-14

3. Log in to the RMC30 with the login data. The default login for the name and
 Siemens AG 2018 All rights reserved

password is: "admin".


Confirm each entry with the <Enter> key.
Figure 2-15

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 29
2 Engineering

Result
You have connected to the RMC30 and can use the command line interface.
Figure 2-16
 Siemens AG 2018 All rights reserved

Configuring the serial interfaces


This application example uses the standard RS485 in the serial Modbus RTU
network. The serial interface in the RUGGEDCOM RMC30 supports several
standards and must be configured to the standard used. Proceed as follows to
configure the serial port of the RMC30:
1. Use the arrow keys to navigate to the menu item "Serial Protocols" and confirm
the selection with the <Enter> key.
Figure 2-17

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 30
2 Engineering

2. Another menu opens. Use the arrow keys to navigate to the menu item
"Configure Serial Ports" and confirm the selection with the <Enter> key.
Figure 2-18

3. The table "Serial Ports" appears. Use the arrow keys to navigate to the first
 Siemens AG 2018 All rights reserved

entry "Port 1" and confirm the selection with the <Enter> key.
Figure 2-19

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 31
2 Engineering

4. The form "Serial Ports" appears. Use the arrow keys to navigate to the entry
"Protocol" and confirm the selection with the <Enter> key. Use the arrow keys
to select the entry "ModbusServer" from the selection list. Confirm the selection
with the <Enter> key.
Figure 2-20
 Siemens AG 2018 All rights reserved

5. Set the other communication parameters as follows:

a. Baud: 57600 (this corresponds to a baud rate of 57.6 kbits/s)


b. Data bits: 8
c. Stop: 1
d. Parity: none
e. Turnaround: 10 ms
f. Hold Time: off
g. DSCP: 0
h. RXToTX-Delay: 0 ms

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 32
2 Engineering

Use the arrow keys to navigate to the each relevant entry in the form and
confirm your selection with the <Enter> key. Set the value correspondingly and
confirm again with the <Enter> key.
Figure 2-21
 Siemens AG 2018 All rights reserved

6. Save the settings once you have made all settings. Pressing the keyboard
shortcut <CTRL> A.
Press the <ESC> key to quit the form "Serial Ports".

Result
You have configured Port 1 of the RMC30 to the "ModbusServer" protocol and set
up the communication parameters identical to the SIMOCODE. Press the <ESC>
key to return to the main menu.
Figure 2-22

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 33
2 Engineering

Setting up the "ModbusServer" protocol


You have set the serial interface in the RUGGEDCOM to the "ModbusServer"
protocol. Proceed as follows to configure the Modbus TCP server protocol for a
serial port:
1. Use the arrow keys to navigate to the menu item "Configure Protocols" and
confirm the selection with the <Enter> key.
Figure 2-23
 Siemens AG 2018 All rights reserved

2. Use the arrow keys to navigate to the menu item "Configure Modbus Server"
and confirm the selection with the <Enter> key.
Figure 2-24

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 34
2 Engineering

3. The table "Modbus Server" appears. Use the arrow keys to navigate to the line
of Port 1 and confirm the selection with the <Enter> key.
Figure 2-25

4. The form "Modbus Server" appears. Set the parameters as follows:


 Siemens AG 2018 All rights reserved

a. Response Timer: 1000 ms


b. Auxiliary TCP Port: Disabled
c. Send Exceptions: Enabled
d. Link Stats: Enabled

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 35
2 Engineering

Use the arrow keys to navigate to each individual entry and confirm your
selection with the <Enter> key. Set the value correspondingly and confirm
again with the <Enter> key.
Figure 2-26
 Siemens AG 2018 All rights reserved

5. Save the settings once you have made all settings. Pressing the keyboard
shortcut <CTRL> A.
Press the <ESC> key to quit the form "Modbus Server".
Result
You have configured the "ModbusServer" protocol. Press the <ESC> key twice to
return to the main menu.
Figure 2-27

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 36
2 Engineering

Saving device addresses


All Devices in the Modbus RTU network can be accessed via a device address. To
enable the RMC30 to communicate with the devices that are linked to its serial
interface, you need to add the device addresses of all connected device in the
configuration of the RMC30.
Follow these steps to add a device address in the RMC30:
1. Use the arrow keys to navigate to the menu item "Configure Device
Addresses" and confirm the selection with the <Enter> key.
Figure 2-28
 Siemens AG 2018 All rights reserved

2. The table "Device Address Table" appears. To add a new device address
(here: Device address 1 for the first SIMOCODE) in the table, press the
keyboard shortcut <CTRL> I.
Figure 2-29

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 37
2 Engineering

3. The form "Device Addresses" appears. Set the parameters as follows:


a. Protocol: ModbusServer
b. Address: 1
c. Remote IP Addr: 173.16.1.77
d. Port:1
e. Name: any, e.g. SIMOCODE_1
Use the arrow keys to navigate to each individual entry and confirm your
selection with the <Enter> key. Set the value correspondingly and confirm
again with the <Enter> key.
Figure 2-30
 Siemens AG 2018 All rights reserved

4. Save the settings once you have made all settings. Pressing the keyboard
shortcut <CTRL> A.
You automatically quit the for "Device Addresses".

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 38
2 Engineering

Result
You have saved the device address (here: Device address: 1) for the first
SIMOCODE in the device address table.
Figure 2-31
 Siemens AG 2018 All rights reserved

5. To save another device address (here: Device address 2 for the second
SIMOCODE) in the table, press the keyboard shortcut <CTRL> I.

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 39
2 Engineering

6. The form "Device Addresses" appears. Set the parameters as follows:


a. Protocol: ModbusServer
b. Address: 2
c. Remote IP Addr: 173.16.1.77
d. Port:1
e. Name: any, e.g. SIMOCODE_2
Use the arrow keys to navigate to each individual entry and confirm your
selection with the <Enter> key. Set the value correspondingly and confirm
again with the <Enter> key.
Figure 2-32
 Siemens AG 2018 All rights reserved

7. Save the settings once you have made all settings. Pressing the keyboard
shortcut <CTRL> A.
You automatically quit the for "Device Addresses".

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 40
2 Engineering

Result
You have saved another device address (here: Device address: 2) for the second
SIMOCODE in the device address table.
You have completed all configuration steps necessary. Press the <ESC> key twice
to return to the main menu. To log out of the RMC30, press the keyboard shortcut
<CTRL> X.
Figure 2-33
 Siemens AG 2018 All rights reserved

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 41
2 Engineering

2.2.5 Downloading modules

SIMATIC and SIMOCODE are downloaded via the TIA Portal.

Downloading the CPU


Highlight your CPU in the project navigation and download the project into the
controller. If there are errors during compilation, fix them.

Downloading SIMOCODE
To enable your programming device to communicate with the SIMOCODE device
via the USB PC cable, you must first install the associated driver (see
Chapter 2.1.2).
Connect your programming device via the SIRIUS USB PC cable to a free
SIMOCODE system interface. Download the project data to the SIMOCODE.

The window for "Extended download to device" appears when first downloading.
1. Enter the interface type "SIRIUS PtP" and the number of the COM interface
used.
2. View all compatible subscribers.
3. Start the search. Start downloading after the SIMOCODE device has been
found.
4. Follow the notes and instructions on the screen during the download process.
 Siemens AG 2018 All rights reserved

Figure 2-34

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 42
2 Engineering

2.3 Operation
Requirement
The following requirements must be fulfilled in order to test the application
example:
 The CPU is configured as a Modbus TCP client and the project is downloaded
to the controller.
 The two SIMOCODE devices are parameterized and downloaded.
 The RMC30 is configured.
 The communication parameters of the serial communication correspond in the
SIMOCODE devices and in the RMC30.
 The RMC30 and the two SIMOCDE devices are correctly connected to one
another, and the bus resistances are set correctly.

Setting static variable "MB_Unit_ID"


Before making a request to a SIMOCODE, make sure that its device address is
saved in the static variable "MB_Unit_ID".
To view and control the static variables, establish an online connection to the CPU
and open the instance data module of the "MB_CLIENT" system instruction or use
the observation table.
 Siemens AG 2018 All rights reserved

Control the variable either with the value "1" for the first SIMOCODE, or with the
value "2" for the second SIMOCODE.
Figure 2-35

Note You can also control the variable via your user program.

Start the request


You start a request to the SIMOCODE by setting the "REQ" variable at the system
instruction to the value "true".
You can find the result of the request in the variable that you have set as a data
buffer with the variable "MB_DATA_PTR".

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 43
3 Appendix

3 Appendix
3.1 Service and Support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
https://support.industry.siemens.com

Technical Support
The Technical Support of Siemens Industry provides you fast and competent
support regarding all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts. Please send queries
to Technical Support via Web form:
www.siemens.com/industry/supportrequest
 Siemens AG 2018 All rights reserved

SITRAIN – Training for Industry


We support you with our globally available training courses for industry with
practical experience, innovative learning methods and a concept that’s tailored to
the customer’s specific needs.
For more information on our offered trainings and courses, as well as their
locations and dates, refer to our web page:
www.siemens.com/sitrain

Service offer
Our range of services includes the following:
 Plant data services
 Spare parts services
 Repair services
 On-site and maintenance services
 Retrofitting and modernization services
 Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
https://support.industry.siemens.com/cs/sc

Industry Online Support app


You will receive optimum support wherever you are with the "Siemens Industry
Online Support" app. The app is available for Apple iOS, Android and Windows
Phone:
https://support.industry.siemens.com/cs/ww/en/sc/2067

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 44
3 Appendix

3.2 Links and Literature


Table 3-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the article page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109760347
\3\ Driver for SIRIUS USB PC cable 3UF7941-0AA00-0
https://support.industry.siemens.com/cs/ww/en/view/55653831
\4\ RUGGEDCOM Explorer Release Notes v1.5.2
https://support.industry.siemens.com/cs/ww/en/view/109750774
\5\ SIMATIC NET PROFIBUS Network Manual System Manual
https://support.industry.siemens.com/cs/ww/en/view/35222591
\6\ FAQ: What function does the "MB_UNIT_ID" parameter have in the instance data
module of the Modbus module "MB_CLIENT"?
https://support.industry.siemens.com/cs/ww/en/view/102420337
\7\ Function Manual SIMOCODE pro – Communication
https://support.industry.siemens.com/cs/ww/en/view/109743960
\8\ Manual Collection - SIMOCODE pro
https://support.industry.siemens.com/cs/ww/en/view/109743951
\9\ Application example: SIRIUS SIMOCODE pro V MR: Communication with a
 Siemens AG 2018 All rights reserved

SIMATIC S7-1200/1500 via MODBUS RTU


https://support.industry.siemens.com/cs/ww/en/view/109246623
\10\ FAQ: How do you program and parameterize the Modbus/TCP communication
between S7-1500 CPU and S7-1200 CPU?
https://support.industry.siemens.com/cs/ww/en/view/102020340
\11\ RUGGEDCOM RMC30 Software Installation Manual
https://support.industry.siemens.com/cs/ww/en/view/88885319
\12\ RUGGEDCOM ROS v4.3 User Manual for RMC30
https://support.industry.siemens.com/cs/ww/en/view/109737240

3.3 Change documentation


Table 3-2
Version Date Change
V1.0 09/2018 First version

Modbus_RMC30
Entry-ID: 109760347, V1.0, 09/2018 45

Potrebbero piacerti anche