Inverted signalsInverted signals are represented by an overline, for example STO_A or
STO_B.
GlossaryExplanations of special technical terms and abbreviations.
0198441113843, V1.01, 01.2012
Modbus-TCP module7
About this manual
Further reading
User Associationhttp://www.modbus.org
LXM32M
IndexList of keywords with references to the corresponding page numbers.
8Modbus-TCP module
0198441113843, V1.01, 01.2012
L
N
LXM32M
1Introduction
1 Introduction
1
Different products with a Modbus TCP interface can be operated in
the same fieldbus. Modbus TCP provides a common basis for interchanging commands and data between the network devices.
Figure 1: Fieldbus products on the network
FeaturesThe product supports the following functions via Modbus TCP:
•
Automatic IP address assignment via BOOTP or DHCP
•
Automatically obtaining configuration data via the FDR (Fast
Device Replacement) service
•
Commissioning via commissioning software
•
Diagnostics and configuration via integrated web server
•
Reading and writing parameters
•
Controlling the drive
•
Monitoring inputs and outputs
•
Diagnostics and monitoring functions
0198441113843, V1.01, 01.2012
Modbus-TCP module9
1 Introduction
LXM32M
10Modbus-TCP module
0198441113843, V1.01, 01.2012
LXM32M
2 Before you begin - safety information
2Before you begin - safety information
2.1Qualification of personnel
Only appropriately trained persons who are familiar with and understand the contents of this manual and all other pertinent product documentation are authorized to work on and with this product. In addition,
these persons must have received safety training to recognize and
avoid hazards involved. These persons must have sufficient technical
training, knowledge and experience and be able to foresee and detect
potential hazards that may be caused by using the product, by changing the settings and by the mechanical, electrical and electronic equipment of the entire system in which the product is used.
All persons working on and with the product must be fully familiar with
all applicable standards, directives, and accident prevention regulations when performing such work.
2
2.2
Intended use
The functions described in this manual are only intended for use with
the basic product; you must read and understand the appropriate
product manual.
The product may only be used in compliance with all applicable safety
regulations and directives, the specified requirements and the technical data.
Prior to using the product, you must perform a risk assessment in view
of the planned application. Based on the results, the appropriate
safety measures must be implemented.
Since the product is used as a component in an entire system, you
must ensure the safety of persons by means of the design of this
entire system (for example, machine design).
Operate the product only with the specified cables and accessories.
Use only genuine accessories and spare parts.
Any use other than the use explicitly permitted is prohibited and can
result in hazards.
Electrical equipment should be installed, operated, serviced, and
maintained only by qualified personnel.
The product must NEVER be operated in explosive atmospheres
(hazardous locations, Ex areas).
0198441113843, V1.01, 01.2012
Modbus-TCP module11
2 Before you begin - safety information
2.3Hazard categories
Safety instructions to the user are highlighted by safety alert symbols
in the manual. In addition, labels with symbols and/or instructions are
attached to the product that alert you to potential hazards.
Depending on the seriousness of the hazard, the safety instructions
are divided into 4 hazard categories.
DANGER indicates an imminently hazardous situation, which, if not
avoided, will result in death or serious injury.
WARNING indicates a potentially hazardous situation, which, if not
avoided, can result in death, serious injury, or equipment damage.
CAUTION indicates a potentially hazardous situation, which, if not
avoided, can result in injury or equipment damage.
LXM32M
DANGER
WARNING
CAUTION
CAUTION
CAUTION used without the safety alert symbol, is used to address
practices not related to personal injury (e.g. can result in equipment
damage).
12Modbus-TCP module
0198441113843, V1.01, 01.2012
LXM32M
2.4Basic information
2 Before you begin - safety information
WARNING
LOSS OF CONTROL
•
The designer of any control scheme must consider the potential
failure modes of control paths and, for certain critical functions,
provide a means to achieve a safe state during and after a path
failure. Examples of critical control functions are emergency stop,
overtravel stop, power outage and restart.
•
Separate or redundant control paths must be provided for critical
functions.
•
System control paths may include communication links. Consideration must be given to the implication of unanticipated transmission delays or failures of the link.
•
Observe all accident prevention regulations and local safety
guidelines.
•
Each implementation of the product must be individually and thoroughly tested for proper operation before being placed into service.
Failure to follow these instructions can result in death or serious injury.
1)
1)
For USA: Additional information, refer to NEMA ICS 1.1 (latest edition), “Safety
Guidelines for the Application, Installation, and Maintenance of Solid State Control”
and to NEMA ICS 7.1 (latest edition), “Safety Standards for Construction and Guide
for Selection, Installation and Operation of Adjustable-Speed Drive Systems”.
0198441113843, V1.01, 01.2012
Modbus-TCP module13
2 Before you begin - safety information
2.5Standards and terminology
Technical terms, terminology and the corresponding descriptions in
this manual are intended to use the terms or definitions of the pertinent standards.
In the area of drive systems, this includes, but is not limited to, terms
such as "safety function", "safe state", "fault", "fault reset", "failure",
"error", "error message", "warning", "warning message", etc.
Among others, these standards include:
•
IEC 61800 series: "Adjustable speed electrical power drive systems"
•
IEC 61158 series: "Industrial communication networks - Fieldbus
specifications"
•
IEC 61784 series: "Industrial communication networks - Profiles"
Modbus TCP is an Ethernet fieldbus. Modbus TCP describes the
transmission of the Modbus protocol via the Ethernet interface and the
TCP/IP transport and network layers.
The Modbus TCP client (master) connects to the Modbus TCP server
(slave). Once the connection is established, the client sends Modbus
requests to the server. These requests are processed by the server.
The result is returned to the client as a Modbus response.
3 Basics
3
3.1.2Bus topology
The Modbus TCP services are identical to the Modbus RTU services.
Star and tree topologies can be used. It is possible to use hubs or
switches. In the case of high bus loads with many devices, it is recommended to use a switches.
The maximum length of a segment is 100 m. A segment consists of
devices and hubs. A network can be subdivided into several segments
by means of gateways or switches. Short cables and a star topology
are recommended to achieve a fast bus cycle.
The transmission rate is 10 or 100 MBit/s in half-duplex mode. If
switches are used, transmission is also possible in full duplex mode.
0198441113843, V1.01, 01.2012
Modbus-TCP module15
Modbus Client
Modbus Server
RequestIndication
Response
Confirmation
3 Basics
3.1.3Client / server model
LXM32M
Figure 2: Client / server model
The Modbus messaging service implements client/server communication between devices connected by means of a TCP/IP network. Modbus TCP does not use an object dictionary.
The client/server model is based on 4 types of messages:
•
Request: Message sent by the client to initiate a transaction.
•
Indication: Request as received by the server.
•
Response: Response message to the request sent by the server.
•
Confirmation: Response as received by the client.
A communication cycle consists of the request from the client (request
from the fieldbus master) and a response from the server (response
from the fieldbus slave). Modbus request and Modbus response have
the same structure. If an error occurs on receipt of the Modbus
request or if the slave cannot execute the action, the slave sends an
error message in the Modbus response.
3.1.4Network service SNMP
SNMP agent ConneXviewThe product supports SNMP version 1.0. An SNMP agent must be
The product analyzes the Modus requests received. Depending on the
Modbus request, the product triggers actions or provides requested
data.
The Internet community has developed the SNMP standard "Simple
Network Management Protocol" to support the management of different network devices by means of a single system.
The Network Management System can exchange data with SNMP
devices. The tasks of the network management system comprise
monitoring, control and configuration of network components as well
as error detection and error messaging.
used to monitor a network with SNMP. Schneider Electric offers the
tool ConneXview for such purposes.
16Modbus-TCP module
0198441113843, V1.01, 01.2012
Function codeDataMBAP Header
MODBUS PDU
MODBUS TCP/IP ADU
LXM32M
3.2Modbus TCP protocol
The Modbus protocol defines a so-called Modbus PDU (Protocol Data
Unit) which is independent of the underlying communication layers.
This Modbus PDU consists of the fields "Function Code" and "Data".
Depending on the mapping to the different network protocols, the
Modbus PDU is extended by additional fields in the so-called Modbus
ADU (Application Data Unit). The Modbus PDU and the Modbus ADU
constitute the Modbus message, also referred to as "Frame".
Figure 3: Structure of a Modbus message
The "Function Code" of a message specified the Modbus service to be
triggered. The "Data" field can contain additional information, depending on the "Function Code".
3 Basics
Due to the encapsulation of "Function Code" and "Data" in the Modbus PDU, the Modbus services and the object model can be the same
in the case of all Modbus versions.
In the case of a "Function Code" for which the "Data" field in the Modbus PDU has a fixed length, the "Function Code" is sufficient.
In the case of a "Function Code" for which the "Data" field in the Modbus request or the Modbus response has a variable amount of data,
the "Data" field contains a byte counter.
The maximum size of a Modbus ADU is 260 bytes. The size of an
embedded Modbus PDU is 253 bytes.
NOTE: The fields are encoded in Big Endian format (highest-value
byte first).
0198441113843, V1.01, 01.2012
Modbus-TCP module17
3 Basics
3.2.1MBAP header
LXM32M
The MBAP header contains the information allowing the recipient to
uniquely identify a message. This is even possible if a message is split
into several packets for transmission.
Explicit and implicit length rules as well as the use of a CRC-32 error
check code (on Ethernet) results in an infinitesimal chance of undetected corruption to a request or response message.
DesignThe MBAP header has a length of 7 bytes and contains the following
fields:
FieldLengthDescription
Transaction Identifier2 bytesIdentification of a Modbus
request or Modbus response.
Protocol Identifier2 bytesValue 0 means Modbus proto-
col.
Length2 bytesNumber of bytes to follow.
Unit Identifier1 byteIdentification of a slave con-
nected to another bus via a
serial line.
•
Transaction Identifier
The field "Transaction Identifier" is used for "Pairing". The server
copies the "Transaction Identifier" of the Modbus request to the
Modbus response.
•
Protocol Identifier
The field "Protocol Identifier" is used to identify the protocol. The
Modbus protocol is identified by the value 0.
•
Length
The "Length" field is a byte counter for the following fields ("Unit
Identifier", "Function Code" and "Data").
•
Unit Identifier
The field "Unit Identifier" is used to identify the server in the slave.
18Modbus-TCP module
0198441113843, V1.01, 01.2012
LXM32M
3.3Modbus TCP communication
3.3.1Connection management
Establishing of a connectionThe Modbus TCP server allows for TCP connections via the default
port 502. A client can establish a new connection via this port. If the
client is to exchange data with a remote server, a new client connection via remote port 502 must be established.
Modbus data transferA Modbus request is sent via a suitable, open connection. This TCP
connection is found using the IP address of the remote device. The
connection remains open for all Modbus communication. Up to 8
simultaneous connections are possible.
As described in the next chapter, a Modbus client can initialize several
Modbus transactions without having to wait for the previous transaction to be finished.
Closing a connectionAfter the Modbus communication between the client and a server is
finished, the client causes the connection used to be closed.
The server does not close the connection under normal circumstances.
3 Basics
However, when errors occur and in special cases, the server closes
the connection, for example:
•
Communication errors
•
Communication inactivity
•
Maximum number of connections reached
The product can manage up to 8 TCP connections. If an attempt is
made to establish a further connection beyond this maximum, the oldest unused connection is closed. If it is impossible to close the oldest
unused connection, the new connection is refused.
0198441113843, V1.01, 01.2012
Modbus-TCP module19
3 Basics
3.3.2Modbus response to a Modbus request
The Modus server generates a Modbus response after having processed a Modbus request.
Depending on the type of processing, two types of Modbus responses
are possible:
•
Positive Modbus response
-
The "Function Code" in the Modbus response corresponds to
the "Function Code" in the Modbus request.
•
Negative Modbus response
-
The client receives pertinent information on error detection during processing;
-
The "Function Code" in Modbus response corresponds to the
"Function Code" in the Modbus request + 80h.
-
The "Exception Code" indicates the cause of the error.
If a syntactically incorrect Modbus PDU (Protocol Data Unit) is transmitted, the connection is terminated. In the case of other other error, a
negative Modbus response is sent.
LXM32M
Exception Code
01Illegal Function Code The "Function Code" is unknown to the
02Illegal Data AddressDepends on the Modbus request
03Illegal Data ValueDepends on the Modbus request
04Server FailureThe server was unable to properly termi-
05AcknowledgeThe server has accepted the Modbus
06Server BusyThe server was unable to accept the
0AGateway ProblemThe gateway path is unavailable.
0BGateway ProblemThe targeted device does not respond.
NameDescription
server.
nate processing.
request. However, the execution takes a
relatively long time. The server therefore
only returns an acknowledgement confirming receipt of the service request.
Modbus request. It is the responsibility of
the application on the client to determine
whether and when to re-send the request.
The gateway generates this error.
20Modbus-TCP module
0198441113843, V1.01, 01.2012
LXM32M
3.3.3Reading and writing parameters
Parameters are processed as 32 bit values. 16 bit values must also be
processed as 32 bit values. Two consecutive 16 bit parameters must
be read or written to process a 16 bit parameter. The first Modbus
address must be specified.
If several consecutive parameters are to be processed, a single Modbus command with the corresponding Modbus address and the length
indication is sufficient.
NOTE: This does not apply to reading and writing parameters with
addresses in the range from 17408 (4400h) to 17663 (44FFh). In this
range, only a single parameter can be addressed with one Modbus
command.
ExampleReading the parameter CTRL1_KPp "Position controller P gain"
Modbus address 4614
When the parameter CTRL1_KPp with the Modbus parameter address
4614 and length 2 is read, the two parameter addresses 4614 and
4615 are read. Result:
AddressValue
46140000
461500C8
3 Basics
h
h
0198441113843, V1.01, 01.2012
Modbus-TCP module21
3 Basics
3.3.4I/O scanning to "Drive Profile Lexium"
I/O scanning is used for cyclic interchange of data between master
and slave.
I/O scanning must be configured on the master. The master can use 2
different approaches for of I/O scanning:
NOTE: The read value is 0 until the first write command is executed.
SettingsThe following setting must be made on the master before you can use
I/O scanning:
•
The "Unit Identifier" is 255.
•
The Modbus parameter address is 0.
•
The data length is 13.
In addition, you can use up to 3 mappable parameters. If these
parameters are used, the data length changes to 15, 17 or 19.
LXM32M
The Modbus addresses for I/O scanning do not differ from the
addresses for normal Modbus access.
Output - InputOutput and input refer to the direction of data transmission from the
perspective of the master.
•
Output: Commands from the master to the slave
•
Input: Status messages from the slave to the master
22Modbus-TCP module
0198441113843, V1.01, 01.2012
LXM32M
3.3.4.1 I/O scanning Output
3 Basics
The table below shows the structure of the cyclic data for the commands from the master to the product. See the product manual for a
description of the parameters.
ParChParameters can be read or written via "ParCh", see chapter
"3.3.4.3 Parameter channel".
dmControlThe word "dmControl" is used to set the operating state and the oper-
ating mode.
See chapters "6.1.2 Changing the operating state" and
"6.2.2 Starting and changing an operating mode" for a detailed
description of the bits.
RefA32, RefB32The two double words "RefA32" and "RefB32" are used to set two val-
ues for the operating mode. The meaning depends on the operating
mode; it is described in the chapters on the individual operating
modes.
Ramp_v_acc / Ramp_v_decThe double words "Ramp_v_acc" and "Ramp_v_dec" are used to set
the acceleration and the deceleration. They correspond to the parameters of the same name. See the product manual for a description.
EthOptMapOut1 ... EthOptMap-
Out3
The double words EthOptMapOut1 ... EthOptMapOut3 contain selectable parameters, see chapter
"5.7.3 Setting the mapping for I/O scanning".
0198441113843, V1.01, 01.2012
Modbus-TCP module23
3 Basics
3.3.4.2 I/O scanning Input
LXM32M
The table below shows the structure of the cyclic data for the status
messages from the product to the master. See the product manual for
a description of the parameters.