Comtrol Corporation makes no representations or warranties with regard to the contents of this document or
to the suitability of the Comtrol product for any particular purpose. Specifications subject to change without
notice. Some software or features may not be available at the time of publication. Contact your reseller for
current product information.
2.1.2. What is Modbus/RTU?.................................................................................................................... 18
2.1.3. What is Modbus/ASCII? ................................................................................................................. 18
2.1.4. What is Modbus/TCP? .................................................................................................................... 19
2.2. Raw Data Interface .............................................................................................................................. 19
6.2. General Troubleshooting.................................................................................................................... 84
6.3. Technical Support ................................................................................................................................ 84
iv- Table of Contents DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Table of Contents
Appendix A. Programming the PLC via Concept .........................................................85
A.2.3.3. Setting up and Running the Concept Example Programs ................................................. 95
Appendix B. LPBKCNCP Example Program ...............................................................103
Appendix C. SCANCNCP Example Program ...............................................................109
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I Table of Contents - v
Table of Contents
vi- Table of Contents DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Chapter 1. Introduction
This User Guide provides detailed information about the following topics:
•Programming Interface
•Embedded Configuration Pages
•Diagnostic and Statistics Pages
•Programming the PLC via Concept
•LPBKCNCP Example Program
•SCANCNCP Example Program
The DeviceMaster UP Hardware Installation and Configuration Guide
•Connecting the hardware and devices
•Programming the DeviceMaster UP IP address,
•Uploading Modbus/TCP firmware
The Modbus/TCP
procedures.
See Locating Updated Software and Documents
tools.
Interface Configuration Quick Start provides embedded web page configuration
on Page 17
on Page 33
on Page 61
on Page 85
on Page 103
on Page 109
provides the following information:
on Page 15 to locate the latest firmware, documentation, and
1.1. Audience
The primary audience of this document is the person responsible for installing the DeviceMaster UP and
programming the PLC. This guide assumes you are familiar with the following topics:
•Windows operating system
•Modbus/TCP, Modbus/RTU, and/or Modbus/ASCII
•A PLC, SCADA System, or OPC Server that communicates with Modbus/TCP, Modbus/RTU, or Modbus/
ASCII
-Raw/ASCII devices such as barcode scanners, weigh scales, and printers
-Modbus/RTU and/or Modbus/ASCII slave devices.
1.2. Comtrol Modbus Solutions
If you ordered the Modbus part number for your DeviceMaster UP, Modbus/TCP is loaded on the
DeviceMaster UP by default. You may want to review our other Modbus solutions to make sure that the
feature rich Modbus/TCP application is what you want to use. Optionally, Modbus Router or Modbus Server
may by more effective for your particular environment.
The Comtrol web site provides information about the differences between the three Modbus solutions:
•M
ODBUS/TCP
•M
ODBUS SERVER
•M
ODBUS ROUTER
In addition, the DeviceMaster UP product CD and ftp site also provide these documents for your reference.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 1. Introduction - 7
Product Overview
The following links function if you are reading this document from the ftp site or CD.
Note: Optionally, open the CD and click Modbus. The main page (
links to these documents.
•Modbus Controller to Controller Communication
•Modbus Solution Examples
•Providing Read-Only Modbus Protection
•Resolving Modbus Device ID Conflicts
If Modbus Server or Modbus Router is a better solution, you can
corresponding documentation.
up_modbus_family_main.htm) provides
DOWNLOAD the appropriate firmware and
1.3. Product Overview
The DeviceMaster UP operates as a highly versatile Modbus gateway when the Modbus/TCP firmware is
uploaded to the DeviceMaster UP. The DeviceMaster UP provides Modbus/TCP, Modbus/RTU, Modbus/
ASCII, and Ethernet TCP/IP controller interfaces to both serial and Ethernet TCP/IP raw/ASCII devices, and
both Modbus/RTU and Modbus/ASCII slave devices.
Your particular DeviceMaster UP model may or may not have the Modbus/TCP firmware loaded (depending
on the model you purchased).
Note: Models that have Modbus/TCP loaded on the DeviceMaster UP are identified in PortVision DX and the
DeviceMaster UP is labeled accordingly.
1.4. Modbus/TCP Firmware
The following subsections provide information for existing users who may or may not want to update systems
with the advanced Modbus/TCP firmware 5.0x. For new users, the following subsections provide Modbus
system architecture information.
1.4.1. Traditional Modbus/TCP System Architecture (Firmware V2.x)
Modbus/TCP firmware V2.x provided a traditional Modbus/TCP slave interface to devices through a raw/
ASCII or Modbus/RTU serial interface as illustrated.
8 -Chapter 1. IntroductionDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Enhanced Modbus/TCP System Architecture (Firmware 3.x)
1.4.2. Enhanced Modbus/TCP System Architecture (Firmware 3.x)
Using the Modbus/TCP firmware V3.x doubles the capacity of the DeviceMaster UP by providing a raw/ASCII
interface to both serial and Ethernet TCP/IP devices. At the same time, the DeviceMaster UP continues to
provide a traditional Modbus/TCP to Modbus/RTU interface for Modbus/RTU slave devices.
•Improved PLC interfaces:
-Transfer of large received serial device packets up to 1024 bytes in Master Receive mode.
-Transfer of large received Ethernet device packets up to 2048 bytes in Master Receive mode.
-Throttling of received data to the PLC in the Master Receive mode.
-Ensures data received by the PLC is not overwritten before it can be processed.
-Disabling of non-filtered receive queue, ensures the PLC will only receive the latest received serial/
Ethernet device data.
•New embedded web pages
-PLC Interface Diagnostics page provides statistics and error messages to monitor and help diagnose
PLC interface problems.
-Serial/Ethernet Device Communication Statistics page is a comprehensive statistics page for all serial
and Ethernet device interfaces. Includes packet, byte, and error counts to the PLC(s) and
application(s) as well as comprehensive filtering statistics.
-Ethernet Device Interface Configuration page provides a user interface to the Ethernet device
interface configuration.
For example:
•The DeviceMaster UP 1-port provides Modbus/TCP support for one raw/ASCII or Modbus/RTU serial
device and one raw/ASCII Ethernet device for a total of two devices.
•The DeviceMaster UP 2-port provides Modbus/TCP support for two raw/ASCII or Modbus/RTU serial
device and two raw/ASCII Ethernet device for a total of four devices.
•The DeviceMaster UP 4-port provides Modbus/TCP support for four raw/ASCII or Modbus/RTU serial
devices and four raw/ASCII Ethernet devices for a total of eight devices.
Modbus/TCP firmware 3.x provides an application interface for both serial and Ethernet raw/ASCII devices.
You can connect any application, such as a configuration, database, or control application, via the application
socket port to raw/ASCII serial and/or Ethernet devices while the device(s) are attached to the PLC via
Modbus/TCP.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 1. Introduction - 9
Advanced Modbus System Architecture (Firmware 5.x)
DeviceMaster UP
1.4.3. Advanced Modbus System Architecture (Firmware 5.x)
Using the Modbus/TCP V5.x firmware provides greatly enhances connectivity options. New options include:
•New Modbus support:
-Modbus/ASCII serial slave device support.
-Modbus/RTU and Modbus/ASCII serial master support. Modbus/RTU and Modbus/ASCII masters
can now connect to Modbus/RTU serial slaves, Modbus/ASCII serial slaves, and both serial and
Ethernet TCP/IP raw/ASCII devices.
•New raw/ASCII functionality:
-Selectable Message Transfer mode
-Data-Stream - Transmit all message to devices immediately. Return all receive data/responses to all
PLC and Application Ethernet TCP/IP connections.
-Command/Response - Transmit messages one command at a time and wait for response(s). Return all
response(s) to command sender only.
This version of the firmware allows up to six Application Ethernet TCP/IP connections for each serial or
socket port configuration. (Device Ethernet TCP/IP configurations still only allow one connection per device.)
10 -Chapter 1. IntroductionDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Modbus/TCP Multi-Mode Connectivity
1.4.4. Modbus/TCP Multi-Mode Connectivity
The Modbus/TCP firmware 5.x supports the following Modbus/TCP communication modes:
•This is provided for
programmers who
strongly prefer polling.
•The DeviceMaster UP
and PLC initiate only
read messages to each
other.
•The PLC will poll for
received serial and/or
Ethernet device data.
•The DeviceMaster UP polls for transmit data to serial and/or Ethernet devices.
•This mode requires the highest possible Ethernet bandwidth usage and provides the least efficient usage
of PLC and DeviceMaster UP processing power.
•Only raw/ASCII devices are supported in this mode.
•The DeviceMaster UP Receive Transfer mode is set to Slave and Transmit Transfer mode is set to Master.
12 -Chapter 1. IntroductionDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Filtering and Data Extraction Functionality (Patent Pending)
1.4.4.5. Filtering and Data Extraction Functionality (Patent Pending)
The DeviceMaster UP provides the following filtering and data extraction functionality.
•Filtering:
-String Filtering of up to 128 bytes of raw/ASCII data to both the PLC and/or application.
-RFID filtering of EPCglobal formatted RFID tag data to both the PLC and/or application.
-Barcode filtering of all UPC/EAN formatted barcodes data to both the PLC and/or application.
-Simplifies PLC and application programming tasks.
•Data Extraction:
-RFID data extraction extracts all parameters, such as company code, product code, and serial
numbers, from any or all of the 43 EPCglobal tag formats. It then transfers the data to the PLC and/
or application in a consistent and simple format.
-Barcode data extraction extracts the company, product, and numbering codes from UPC/EAN
formatted barcodes. It then transfers the data to the PLC and/or application in a consistent and
simple format.
-Simplifies PLC and application programming tasks.
•Environment specific support:
-Support for multiple RFID reader tag formats.
-RFID antenna grouping.
-Aging of filtered string/RFID/barcode entries.
-Discarding of unrecognized RFID and barcode messages.
For detailed information about filtering and data extraction, see the DeviceMaster UP Filtering and Data
Extraction Reference Guide.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 1. Introduction - 13
Definitions and Terms
1.5. Definitions and Terms
This section describes the Modbus/TCP definitions and terms included in the Modbus/TCP interface and
supported by the DeviceMaster UP.
1.5.1. Data Type Definitions
The following list defines the available data types.
Data TypeDefinition
BYTEBit String (8-bits)
DINTSigned Double Integer (32-bits)
DWORDBit String (32-bits)
INT Signed Integer (16-bits)
STRING Character String (1-byte per character)
UDINTUnsigned Double Integer (32-bits)
USINTUnsigned Short Integer (8-bits)
WORD Unsigned Integer (16-bits)
1.5.2. Glossary
The following list defines terms associated with Modbus/TCP.
TermDefinition
Alias Device ID
Device ID
Ethernet Device A device that communicates through an Ethernet TCP/IP connection.
Master Device
Modbus
Modbus SerialThe Modbus protocol over a serial connection.
Modbus/ASCII
Modbus/RTUModbus Serial in binary format.
Modbus/TCP
Raw Serial
Device
Slave Address The address of the slave device. This term is identical to Unit Identifier and Device ID.
Slave DeviceA device that only responds to Modbus messages.
Socket PortThe Ethernet socket port that is used to communicate to an Ethernet device.
The device ID that the original received ID is changed to when an Alias Device ID is
configured.
The address of the slave device and the term is identical to Unit Identifier and Slave Address.
A device that transmits Modbus/TCP messages to slave devices and receives the
corresponding responses.
An application layer messaging protocol that provides client/server communications
between devices connected on different types of buses.
Modbus Serial in ASCII format. This form of Modbus communication requires two
characters for each byte.
The Modbus protocol over an Ethernet TCP/IP connection. Also known as Modbus over
Ethernet.
A common serial device that communicates over serial ports through plain byte or ASCII
data messages.
14 -Chapter 1. IntroductionDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Locating Updated Software and Documents
TermDefinition (Continued)
Unit IdentifierThe address of the slave device and the term is identical to Device ID and Slave Address.
1.6. Locating Updated Software and Documents
You can access the firmware software assembly, PortVision DX, and the DeviceMaster UP documentation
from the CD shipped with the DeviceMaster UP or you can download the latest files from:
ftp://ftp.comtrol.com/html/up_modbus_tcp_main.htm
1.7. Modbus/TCP Application Setup
Before you can configure the Modbus/TCP firmware on the DeviceMaster UP, you must have previously
performed the following steps:
•Install the hardware
•Install PortVision DX
•If necessary, upload the Modbus/TCP firmware using PortVision DX
Note: Models that have Modbus/TCP loaded on the DeviceMaster UP are identified in PortVision DX and
the DeviceMaster UP is labeled accordingly.
•Configure the DeviceMaster UP IP address using PortVision DX
Note: If necessary, refer to the DeviceMaster UP Hardware Installation and Configuration Guide
above procedures.
Use the following steps to complete the DeviceMaster UP configuration for Modbus/TCP.
1. Program the Modbus/TCP PLC (refer to the information in Programming Interface
2. Configure the DeviceMaster UP serial and Ethernet device interface settings using the Modbus/TCP
Interface Configuration Quick Start. You can use Embedded Configuration Pages on Page 33) as a
reference if you need additional information about fields on the web pages.
3. Connect your serial device or devices and make sure all Ethernet devices are attached to the same
Ethernet subnet. If necessary, refer to the DeviceMaster UP Hardware Installation and Configuration
Guide.
on Page 17).
for the
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 1. Introduction - 15
Modbus/TCP Application Setup
16 -Chapter 1. IntroductionDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Chapter 2. Programming Interface
2.1. Overview
The DeviceMaster UP provides highly flexible Modbus connectivity.
•Modbus masters supported include Modbus/TCP and Modbus/RTU and Modbus/ASCII serial masters.
•Both serial Modbus/RTU and Modbus/ASCII slave devices are supported.
•All Modbus masters can communicate with all Modbus slave devices.
•The Modbus/RTU and Modbus/ASCII Protocol Interface is defined in (2.4.
ASCII To-Slaves Protocol Interface on Page 29).
The DeviceMaster UP provides highly advanced raw/ASCII device functionality:
•Both serial and Ethernet TCP/IP devices are supported.
•Modbus interfaces include Modbus/TCP masters, Modbus/TCP slaves, and both Modbus/RTU and
Modbus/ASCII serial masters.
•Up to six Ethernet TCP/IP Application connections per serial or Ethernet TCP/IP device.
•The raw/ASCII interface is defined in (2.2.
You must configure the DeviceMaster UP through its embedded web pages defined in Chapter 3.
Configuration Pages on Page 33.
The DeviceMaster UP uses normal Modbus addressing conventions and provides receive, transmit, and
statistical data.
Appendix A.
examples provided with the DeviceMaster UP. It describes how to configure the DeviceMaster UP for raw
serial data and start running the example programs using the embedded web pages and the example PLC
program code.
Note: While the Concept PLC example programs directly apply only to the Schneider Electric Momentum,
Programming the PLC via Concept on Page 85 describes the Concept™ PLC programming
Quantum, and Compact PLCs, they can be used as a guide for programming other PLCs.
Raw Data Interface on Page 19).
Modbus/RTU and Modbus/
Embedded
2.1.1. Modbus Master Requirements
Modbus Masters (Modbus/TCP, Modbus/RTU serial, and Modbus/ASCII) must meet these requirements:
•The Modbus Master must support the corresponding protocol.
•For raw/ASCII data, the Modbus Master must support the Read Holding Registers and Write Multiple
Registers commands or, alternatively, the Read/Write Multiple Registers command.
•The Modbus Master must be able to write enough data in one message to handle the maximum sized
messages required for the serial or Ethernet device.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 2. Programming Interface - 17
What is Modbus/RTU?
2.1.2. What is Modbus/RTU?
Modbus/RTU is native Modbus in hexadecimal format. These are the base Modbus messages that contain
simple read and write requests. The format is as follows:
Where:
•The terms Master or Client are used to identify the sender of the message.
•The terms Slave or Server are used to identify the devices responding to the message.
Modbus/RTU is used primarily for:
•Serial port connectivity. RS-485 is the most common serial mode, but RS-232 and RS-422 are also widely
used. Commonly used by both Master and Slave devices.
•Ethernet TCP/IP socket connections. This is not the same as Modbus/TCP (please see section on Modbus/
TCP), but does provide a very simple method of interfacing to remote devices. It is used by many
applications and some OPC servers.
Note: This communication method typically is not supported by PLCs.
2.1.3. What is Modbus/ASCII?
Modbus/ASCII is native Modbus in ASCII format. This protocol is used primarily by legacy devices and is no
longer supported as widely as Modbus/RTU.
Like Modbus/RTU, Modbus/ASCII contains the base Modbus messages that contain simple read and write
requests. The differences between Modbus/ASCII and Modbus/RTU are:
1. The message data is sent in ASCII format, so the message length is twice as long. It requires two ASCII
characters for each byte of data.
2. An 8 bit LRC is attached to verify the message instead of a 16 bit CRC. The LRC is also transmitted in
ASCII format.
3. There are defined starting and ending characters to determine a Modbus/ASCII messages.
The format is as follows:
Where:
•The terms Master or Client are used to identify the sender of the message.
•The terms Slave or Server are used to identify the devices responding to the message.
Modbus/ASCII is used primarily for:
•Serial port connectivity. RS-485 is the most common serial mode, but RS-232 and RS-422 are also used.
Used primarily by legacy Slave devices.
•Ethernet TCP/IP socket connections. This is not the same as Modbus/TCP (please see section on Modbus/
TCP), but does provide a very simple method of interfacing to remote devices. It is used by some
applications and some OPC servers.
Note: This communication method typically is not supported by PLCs.
18 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
What is Modbus/TCP?
2.1.4. What is Modbus/TCP?
Modbus/TCP is an Ethernet network based protocol that contains a Modbus/RTU message, with the exception
of the 2 byte CRC. The Modbus/TCP message contains a header with information designed to provide message
identification and routing information. The format is as follows:
Where:
•The terms Master or Client are used to identify the sender of the message.
•The terms Slave or Server are used to identify the devices responding to the message.
•Modbus TCP messages are typically sent to and received on a defined Ethernet TCP/IP socket of 502.
•Modbus TCP implementations provide more capability, but also require more processing than simpler
Modbus/RTU implementations.
Modbus TCP is used for connecting advanced Ethernet based devices, such as PLCs, HMIs, SCADA Systems,
and most OPC Servers to:
•Other Ethernet devices supporting Modbus TCP.
•Serial Modbus/RTU and/or Modbus/ASCII devices through gateways (such as the DeviceMaster UP
running the Modbus/TCP or Modbus Router applications).
•Serial or Ethernet TCP/IP raw/ASCII devices (barcode scanners, printers, RFID readers, visions systems,
etc) through a gateway (such as the DeviceMaster UP running the Modbus/TCP application).
2.2. Raw Data Interface
This subsection contains the following topics:
•Supported Modbus Messages
•Serial Port Raw/ASCII Interface
•Ethernet Device Raw/ASCII Interface
•Receive Data Message
•Transmit Data Message
•Sequence Number Messages
(Raw Data) on Page 23
2.2.1. Supported Modbus Messages
DeviceMaster UP supports the following Modbus messages over Modbus/TCP for raw data transfer.
Message TypeFunction Code Maximum Message Size Maximum Serial Packet Size
Serial Port 1 Serial Port 2 Serial Port 3 Serial Port 4 Access Rule
1000 (Base 0)
1001 (Base 1)
1256 (Base 0
1257 (Base 1)
1300 (Base 0)
1301 (Base 1)
1556 (Base 0)
1557 (Base 1)
1600 (Base 0)
1601 (Base 1)
2000 (Base 0)
2001 (Base 1)
2256 (Base 0
2257 (Base 1)
2300 (Base 0)
2301 (Base 1)
2556 (Base 0)
2557 (Base 1)
2600 (Base 0)
2601 (Base 1)
3000 (Base 0)
3001 (Base 1)
3256 (Base 0
3257 (Base 1)
3300 (Base 0)
3301 (Base 1)
3556 (Base 0)
3557 (Base 1)
3600 (Base 0)
3601 (Base 1)
4000 (Base 0)
4001 (Base 1)
4256 (Base 0
4257 (Base 1)
4300 (Base 0)
4301 (Base 1)
4556 (Base 0)
4557 (Base 1)
4600 (Base 0)
4601 (Base 1)
Read Only
Read/Write
Read/Write
Read/Write
Read/Write
20 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
2.2.3. Ethernet Device Raw/ASCII Interface
Ethernet Device Raw/ASCII Interface
Socket Port Raw
Data Addressing
Socket Port 1 Socket Port 2 Socket Port 3 Socket Port 4 Access Rule
Unit ID254 (FE hex)254 (FE hex)254 (FE hex)254 (FE hex)N/A
Receive Data
Address
Receive Data
Sequence Number
Address
Transmit Data
Address
Transmit Data
Sequence Number
Address
1000 (Base 0)
1001 (Base 1)
1256 (Base 0
1257 (Base 1)
1300 (Base 0)
1301 (Base 1)
1556 (Base 0)
1557 (Base 1)
2000 (Base 0)
2001 (Base 1)
2256 (Base 0
2257 (Base 1)
2300 (Base 0)
2301 (Base 1)
2556 (Base 0)
2557 (Base 1)
3000 (Base 0)
3001 (Base 1)
3256 (Base 0
3257 (Base 1)
3300 (Base 0)
3301 (Base 1)
3556 (Base 0)
3557 (Base 1)
4000 (Base 0)
4001 (Base 1)
4256 (Base 0
4257 (Base 1)
4300 (Base 0)
4301 (Base 1)
4556 (Base 0)
4557 (Base 1)
Read Only
Read/Write
Read/Write
Read/Write
2.2.4. Raw/ASCII Transfer Modes
The DeviceMaster UP supports two different raw/ASCII message transfer modes. The default Data-Stream
mode is the traditional transfer mode that asynchronously transmits messages and returns received data/
responses. The Command/Response mode provides a synchronous transfer mode for sending and returning
responses.
2.2.4.1. Data-Stream Mode
The Data-Stream transfer mode is the default transfer mode that asynchronously transmits messages from
all Modbus and Application interfaces and returns received data/responses to all Modbus and Application
interfaces. This mode is typically used in installations that utilize only one controller and for receive-only
devices such as barcode scanners, RFID readers, weigh scales, and position encoders.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I Chapter 2. Programming Interface - 21
Command/Response Mode
2.2.4.2. Command/Response Mode
The Command/Response mode provides the following functionality:
•A synchronous transfer mode for sending and returning responses from all Modbus and Application
Ethernet TCP/IP interfaces to serial and Ethernet TCP/IP devices.
•Only one command message is transmitted at a time. Command messages are queued if a command
message is active.
•Responses are routed only to the message sender.
•Responses are timed out and old responses, (ones not requested within a certain time frame), destined for
the Modbus interface are discarded.
•The expected response count is configurable. While this is typically one, some devices may return multiple
responses per message.
The Command/Response transfer mode is typically required in installations that require multiple controllers
sending raw/ASCII messages with expected responses, and it is desired that each controller only receive its
own responses.
22 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Receive Data Message (Raw Data)
2.2.5. Receive Data Message (Raw Data)
The following topics are discussed:
•Format
•Communication Methodology (Receive Raw Data in Slave Mode)
•Communication Methodology (Receive Data Master Mode)
2.2.5.1. Format
The Receive Data message for raw data contains a simple protocol including a sequence number, length and
serial data fields. The Modbus standard requires a WORD format.
The following table displays the format of the Receive Data message.
Receive messages have the following characteristics:
•It returns all data in WORDs.
•The DeviceMaster UP increments the sequence number when it returns new data.
•The message received from the PLC determines the actual length of the Modbus message returned to the
PLC. (This is often greater than the length of the actual number of valid bytes in the Receive Data
Message.)
•All unused bytes in a Modbus message returned to the PLC are filled with zeroes.
•The default order of the bytes is Least Significant Byte First. However, you can select the Rx MS Byte
First option in the web page to return bytes by Most Significant Byte First. For more information, see Rx
MS Byte First under 3.3.5.
Serial Port Packet ID Settings (Raw-Data Only) on Page 39.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 2. Programming Interface - 23
Communication Methodology (Receive Raw Data in Slave Mode)
2.2.5.2. Communication Methodology (Receive Raw Data in Slave Mode)
Raw serial and/or EtherNet
device data is returned in
the response to the Read Holding Registers message
or, optionally, the Read/Write Multiple Register
message. The data is
requested by accessing the
corresponding receive data
address for the desired port.
The following restrictions
apply to this method:
•The Device Index must be 255 (FF hex) for raw/ASCII serial data and 254 (FE hex) for raw/ASCII
Ethernet device data.
•The variable to receive the data on the PLC must be:
-In the 40xxxx address range. (For Modicon type PLCs.)
-An array of 16 bit words.
-Of sufficient size to contain the sequence number, length, and data field associated with the received
data structure. For more information, see the 2.2.5.
Receive Data Message (Raw Data) definition on
Page 23.
•New data will be indicated with an incremented sequence number.
The same data may be returned more than once. However, the same data packet will also return the same
sequence number.
•No data will be indicated with a length of zero.
2.2.5.3. Communication Methodology (Receive Data Master Mode)
Raw serial and/or Ethernet
device data is written to the
PLC at the configured
address.
The following restrictions
apply to this method:
•The Device Index must be
configured for the target
PLC.
•The variable to receive
the data on the PLC
must be:
-In the 40xxxx. (For Modicon type PLCs.)
-An array of 16 bit words.
-Of sufficient size to contain the sequence number, length, and data field associated with the received
data structure.
•New data will be indicated with an incremented sequence number.
24 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Transmit Data Message (Raw Data)
2.2.6. Transmit Data Message (Raw Data)
The following topics are discussed:
•Format
•Communication Methodology (Transmit Raw Data Slave Mode)
•Communication Methodology (Transmit Data Master Mode)
2.2.6.1. Format
The Transmit Data message for raw data contains a simple protocol including a sequence number, length and
serial data fields. The Modbus standard requires a WORD format.
The following table displays the format of the Transmit Data message.
Transmit messages have the following characteristics:
•It transfers all data in WORDs.
•If the Disable Tx Sequence Number Check option is not selected, the sequence number must be incremented
when there is new data to transmit.
•The data length field indicates the number of valid bytes contained in the message.
•The actual length of a message received from the PLC may contain extra, unused data.
•It ignores all unused bytes in a Modbus message.
•The default order of the bytes is Least Significant Byte First. However, you can select the Tx MS Byte First
option in the web page to transmit bytes by Most Significant Byte First. For more information, see Tx MS
Byte First under 3.3.5.
Serial Port Packet ID Settings (Raw-Data Only) on Page 39.
•A request for the Transmit data returns the last transmit data message.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 2. Programming Interface - 25
Communication Methodology (Transmit Raw Data Slave Mode)
2.2.6.2. Communication Methodology (Transmit Raw Data Slave Mode)
Raw serial and/or EtherNet
device data is sent in the
Write Multiple Registers
message or, optionally, the
Read/Write Multiple
Register message. The data
is requested by accessing
the corresponding transmit
data address for the desired
port.
The following restrictions
apply to this method:
•The Device Index must be 255 (FF hex) for raw/ASCII serial data and 254 (FE hex) for raw/ASCII
Ethernet device data.
•The variable to transmit the data on the PLC must be:
-In the 40xxxx address range. (For Modicon type PLCs.)
-An array of words.
-Of sufficient size to contain the sequence number, length, and data field associated with the transmit
data structure, typically 128 words. See 2.2.6.
Transmit Data Message (Raw Data) on Page 25 for
more information.
•If the Disable Tx Sequence Number Check option is not selected, the sequence number must be incremented
when there is new data to transmit. The same transmit data message may be sent to the DeviceMaster
UP more than once. However, the data packet will only be transmitted when a new sequence number is
received.
2.2.6.3. Communication Methodology (Transmit Data Master Mode)
Raw serial and/or Ethernet
transmit data is polled from
the PLC at the configured
address and, when the
DeviceMaster UP receives a
transmit message with an
updated sequence number,
the data is transmitted to
the serial or Ethernet
device.
•The following
restrictions apply to this
method:
•The Device Index must be configured for the target PLC.
•The variable to receive the data on the PLC must be:
-In the 40xxxx. (For Modicon type PLCs.)
-An array of 16 bit words.
-Of sufficient size to contain the sequence number, length, and data field associated with the transmit
data structure.
•The PLC will indicate new data to transmit with an incremented sequence number. (The Disable Tx Sequence Number Check option does not apply to transmit data master mode.)
•The length will indicate the number of bytes to transmit.
•The DeviceMaster UP will expect the length parameter and data to transmit to be updated before the
transmit sequence number is incremented. Therefore, as soon as the DeviceMaster UP receives an
incremented transmit number, it will transmit the data to the serial or Ethernet device.
26 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Sequence Number Messages (Raw Data)
2.2.7. Sequence Number Messages (Raw Data)
Read Holding Registers and Write Multiple Register messages can read and modify both receive and transmit
produced data sequence numbers. These are the same sequence numbers returned to the PLC in the Receive Data Message and sent to the DeviceMaster UP in the Transmit Data message. Access to these sequence
numbers are provided primarily for initialization purposes at the start of the PLC program when you may
want to initialize the sequence numbers on the PLC, DeviceMaster UP or both.
2.3. I/O Scanner (Raw Data)
The I/O Scanner is an optional
PLC communications method
that is implemented on some
PLC programming software
such as the Concept
programming package for use
with the Schneider Electric
Modicon PLCs. The I/O
Scanner provides a rather
simple method that requires
minimal programming effort. It
automatically performs the
polling and transmitting of
data at set time intervals and typically utilizes the Read/Write multiple Registers message.
The following restrictions apply to this method:
•The Receive and Transmit mode for the serial and/or Ethernet device must both be set to Slave mode.
•The Device Index must be 255 (FF hex) for raw/ASCII serial data and 254 (FE hex) for raw/ASCII
Ethernet device data.
•The variable to receive the data on the PLC must be:
-In the 40xxxx address range. (For Modicon type PLCs.)
-An array of words.
-Of sufficient size to contain the sequence number, length, and data field associated with the received
data structure, typically 128 words. For more information, see the 2.2.5.
Data) definition on Page 23.
•New received data will be indicated with an incremented sequence number.
The same data may be returned more than once. However, the same data packet will also return the same
sequence number.
•No receive data will be indicated with a length of zero.
•The variable to transmit the data on the PLC must be:
-In the 40xxxx address range. (For Modicon PLCs.)
-An array of words.
-Of sufficient size to contain the sequence number, length, and data field associated with the transmit
data structure, typically 128 words. See 2.2.6.
more information.
•If the Disable Tx Sequence Number Check option is not selected, the sequence number must be incremented
when there is new data to transmit.
The same transmit data message may be sent to the DeviceMaster UP more than once. However, the data
packet will only be transmitted when a new sequence number is received.
•The DeviceMaster UP should be reset before starting a PLC program using the I/O Scanner due to PLC
program execution scheduling. If the DeviceMaster UP is not reset, the sequence numbers may be out of
sync. This may result in receiving outdated serial data as well as an unexpected transmission of serial
data. A Transmit Unexpected Sequence Number error may also occur.
Transmit Data Message (Raw Data) on Page 25 for
Receive Data Message (Raw
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 2. Programming Interface - 27
I/O Scanner (Raw Data)
The following depicts a typical I/O Scanner screen.
28 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Modbus/RTU and Modbus/ASCII To-Slaves Protocol Interface
2.4. Modbus/RTU and Modbus/ASCII To-Slaves Protocol Interface
The DeviceMaster UP provides access to serial Modbus/RTU and Modbus/ASCII slave devices via Modbus/
TCP, serial Modbus/RTU masters, and serial Modbus/ASCII masters. Modbus master messages are
translated to Modbus/RTU or Modbus/ASCII messages, devices are automatically located, and appropriate
Modbus responses are returned to the Modbus masters.
2.4.1. Communication Methodology
The DeviceMaster UP translates Modbus master messages into Modbus/RTU or Modbus/ASCII messages and
forwards them to slave devices attached to the Modbus/RTU or Modbus/ASCII slave serial ports. Each
Modbus message is transmitted and a response is expected. The DeviceMaster UP times out the Modbus/RTU
or Modbus/ASCII messages if there is no response returned within the configured timeout period.
The following diagram displays the Modbus message transfer.
The following apply to Modbus slaves serial ports.
•All valid Modbus master messages are translated to Modbus slave messages for serial port transmission.
•Modbus slave devices are automatically located on a DeviceMaster UP 2-port or 4-port.
•Messages are timed out if no response is returned within the configured timeout period.
•Appropriate Modbus responses are returned to the Modbus master.
•Broadcast Modbus messages, those with a unit identifier of zero, are transmitted out all Modbus slave
serial ports on the DeviceMaster UP.
The following restrictions apply to the Modbus slave interface:
•The DeviceMaster UP serves as a slave Modbus/TCP device, a master on Modbus To-Slaves serial ports,
and a slave on Modbus To-master serial ports.
•All Modbus slave devices attached to a DeviceMaster UP gateway (1, 2, or 4-port) must have unique Unit Identifiers. Valid Unit Identifiers are 1 to 247 and the Broadcast Identifier is zero.
To communicate to Modbus slave device(s) through a DeviceMaster UP, perform the following steps.
1. Using the embedded web page, select the appropriate Port.
2. Under Serial Configuration, configure the serial port parameters such as the Mode, Baud rate, Data Bits,
and so forth.
3. Under General Protocol Settings, set the Select Serial Port Protocol to Modbus slave.
4. Under Modbus Slave Protocol Settings, set the Device Response Timeout to the desired value.
Note: 2- and 4-Port only: set the Lost Device Search Enable setting. For a discussion on this setting, see
2.4.2.
Modbus Slave Device Search Methodology on Page 30.
DeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. IChapter 2. Programming Interface - 29
Modbus Slave Device Search Methodology
5. In the PLC program, address messages to the Modbus slave device using the IP Address of the
DeviceMaster UP and the Unit Identifier of the slave device(s).
2.4.2. Modbus Slave Device Search Methodology
Locating a Modbus slave device on a DeviceMaster UP 1-port is relatively simple. Either the Modbus slave
device is connected to the port or it is not. However, if more than one port is configured for Modbus slave on a
DeviceMaster UP 2- or 4-port, the device must be found. The following is an explanation of how the search
algorithm works on a DeviceMaster UP 2- or 4-port.
Locating a Modbus slave device after a reboot or port reset:
When the DeviceMaster UP receives a message for a Modbus slave device for the first time since reboot or
port initialization, it will transmit the Modbus slave message out all Modbus slave serial ports and wait for a
response to be returned. Once the response is returned, the device port is known and all messages sent to the
device will be routed through the serial port.
Lost Devices:
Lost devices, or devices that time out, are a special case. The DeviceMaster UP provides two methods for
handling lost devices via the Lost Device Search Enable option on the web page.
•Disabling this option on a Modbus slave port:
-Prevents the DeviceMaster UP from searching for a lost device on other Modbus slave ports.
-Prevents lost devices known to have been on other ports from being searched for on this port.
Note: This is the recommended setting whenever it is desired to prevent timeout delays on other Modbus
slave ports in the event that a device times out.
•Enabling this option on a Modbus slave port:
-Allows the DeviceMaster UP to search for lost devices on all Modbus slave ports with the Lost Device
Search Enable option turned on.
Note: This can be useful for locating devices if a device has been moved onto another port by moving
the serial cable or, perhaps, by moving the device onto a different Modbus slave serial loop.
-This will cause timeout delays on all Modbus slave ports with the Device Search Enable option turned
on until the device is found.
30 - Chapter 2. Programming InterfaceDeviceMaster UP Modbus/TCP User Guide: 2000447 Rev. I
Loading...
+ 82 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.