MODBUSr TCP for H0/H2/H4--ECOM100

MODBUSr TCP for H0/H2/H4--ECOM100
MODBUSr TCP for
H0/H2/H4--ECOM100
In This Chapter. . . .
— MODBUS TCP
— Supported MODBUS Function Codes
— Network Server Operation
— Network Client Operation
— H0/H2/H4--ECOM100 System Memory
15
5--2
MODBUS TCP for H0/H2/H4--ECOM100
MODBUS TCP
Client / Server
Model
MODBUS TCP is essentially the serial MODBUS RTU protocol encapsulated in a
TCP/IP wrapper. MODBUS RTU is used for serial communications between a
master and slave(s) devices. MODBUS TCP is used for TCP/IP communications
between client and server devices on an Ethernet network. The TCP version of
MODBUS follows the OSI Network Reference Model.
The MODBUS messaging service provides a Client/Server communication
between devices connected on an Ethernet TCP/IP network. This client / server
model is based on four type of messages:
• MODBUS Request -- the message sent on the network by the Client to
initiate a transaction
• MODBUS Confirmation -- the Response Message received on the Client
side
• MODBUS Indication -- the Request message received on the Server
side
• MODBUS Response -- the Response message sent by the Server
Client / Server Model
Request
Indication
Client
Server
Confirmation
Protocol
Description
A typical MODBUS TCP frame consists of the following fields:
TCP HEADER
MODBUS TCP
H0/H2--ECOM100
Response
The H0/H2--ECOM100 can
act as a Client or Server
MBAP HEADER
FUNCTION
DATA
The MBAP header (MODBUS Application Protocol header) is seven bytes long. It
consists of the following fields.
• Transaction Identifier -- It is used for transaction pairing, the MODBUS
server copies in the response the transaction identifier of the request. (2
bytes)
• Protocol Identifier -- It is used for intra--system multiplexing. The
MODBUS protocol is identified by the value 0. (2 bytes)
• Length -- The length field is a byte count of the following fields, including
the Unit Identifier and data fields. (2 bytes)
• Unit Identifier -- This field is used for intra--system routing purpose. It is
typically used to communicate to a MODBUS or a MODBUS+ serial line
slave through a gateway between an Ethernet TCP/IP network and a
MODBUS serial line. This field is set by the MODBUS Client in the
request and must be returned with the same value in the response by
the server. (1 byte)
This header provides some differences compared to the MODBUS RTU application
data unit used on serial line:
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP/IP for H0/H2/H4--ECOM100
•
•
•
5--3
The MODBUS “slave address” field usually used on MODBUS Serial
Line is replaced by a single byte “Unit Identifier” within the MBAP
Header. The “Unit Identifier” is used to communicate via devices such
as bridges, routers and gateways that use a single IP address to
support multiple independent MODBUS end units.
All MODBUS requests and responses are designed in such a way that
the recipient can verify that a message is finished. For function codes
where the MODBUS PDU has a fixed length, the function code alone is
sufficient. For function codes carrying a variable amount of data in the
request or response, the data field includes a byte count.
Protocol Identifier -- It is used for intra--system multiplexing. The
MODBUS protocol is identified by the value 0. (2 bytes)
The function code field of a message contains 8 bits. Valid function codes are in the
range of 1 -- 255 decimal. The function code instructs the slave what kind of action to
take. Some examples are to read the status of a group of discrete inputs; to read the
data in a group of registers; to write to an output coil or a group of registers; or to read
the diagnostic status of a slave.
When a slave responds to the master, it uses the function code field to indicate either
a normal response or that some type of error has occurred. For a normal response,
the slave echoes the original function code. In an error condition, the slave echoes
the original function code with its MSB set to a logic 1.
Installation and
The data field is constructed using sets of two hexadecimal digits in the range of 00
to FF. According to the network’s serial transmission mode, these digits can be made
of a pair of ASCII characters or from one RTU character.
The data field also contains additional information that the slave uses to execute the
action defined by the function code. This can include internal addresses, quantity of
items to be handled, etc.
The data field of a response from a slave to a master contains the data requested if
no error occurs. If an error occurs, the field contains an exception code that the
master uses to determine the next action to be taken. The data field can be
nonexistent in certain types of messages.
MODBUS TCP
H0/H2--ECOM100
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
5--4
MODBUS TCP for H0/H2/H4--ECOM100
NOTE: ModScan32 is a Windows based application program that can be used as a
MODBUS master to access and change data points in a connected device
(H0/H2/H4--ECOM100) The utility is ideally suited for quick and easy testing of
MODBUS TCP network slave devices. Visit www.win--tech.com to download a free
ModScan32 trial demo and for more information on ModScan32.
Supported MODBUS Function Codes
The following MODBUS function codes are supported by the H0/H2/H4--ECOM100.
Not all function codes are supported when the ECOM100 serves as a network client.
The “Network Client Operation” section later in this chapter lists the function codes
that are supported in client mode.
MODBUS
Function Code
Function
Server
Mode
Client
Mode
Read Output Table
yes
yes
02
Read Input Table
yes
yes
03
Read Holding Registers (when addressing
mode is 584/984, this function is used to access analog output registers)
yes
yes
04
Read Input Registers (when addressing mode
is 584/984, this function is used to access
analog input registers)
yes
yes
05
Force Single Output
yes
no
06
Preset Single Registers
yes
no
08
Loop back / Maintenance
yes
no
15
Force Multiple Outputs
yes
yes
16
Preset Multiple Registers
yes
yes
MODBUS TCP
H0/H2--ECOM100
01
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP/IP for H0/H2/H4--ECOM100
5--5
Network Server (slave) Operation
This section describes how other MODBUS TCP clients on a network can communicate
with an H0/H2/H4--ECOM100 that you have configured for MODBUS TCP protocol. A
network client must send a MODBUS function code and MODBUS address to specify a
PLC memory location the DL05/06/205/405 CPU. No CPU ladder logic is required to
support MODBUS TCP server operation.
MODBUS Function The H0/H2/H4--ECOM100 supports the following MODBUS function codes when
Codes Supported acting as a MODBUS TCP server.
MODBUS
Function Code
Determining the
MODBUS Address
Function
DL05/06/205 /405
Data Types Available
01
Read Output Table
Y, C, T, CT
02
Read Input Table
X, SP
03
Read Holding Registers (when addressing
mode is 584/984, this function is used to access analog output registers)
V
04
Read Input Registers (when addressing mode
is 584/984, this function is used to access
analog input registers)
V
05
Force Single Output
Y, C, T, CT
06
Preset Single Registers
V
08
Loop back / Maintenance
15
Force Multiple Outputs
Y, C, T, CT
16
Preset Multiple Registers
V
Installation and
There are typically two ways that most MODBUS addressing conventions allow you
to specify a PLC memory location. These are:
• By specifying the MODBUS data type and address
• By specifying a MODBUS address only.
MODBUS TCP
H0/H2--ECOM100
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
5--6
MODBUS TCP for H0/H2/H4--ECOM100
If Your Host Software Many MODBUS TCP clients allow you to specify the MODBUS data type and the
or Client Requires
MODBUS address that corresponds to the PLC memory location. This is the easiest
the Data Type and
method, but not all packages allow you to do it this way.
Address
The actual equation used to calculate the address depends on the type of PLC data
you are using. The PLC memory types are split into two categories for this purpose.
• Discrete -- X, SP, Y, C, S, T(contacts), CT (contacts)
• Word -- V--memory, Timer current value, Counter current value
In either case, you basically convert the PLC octal address to decimal and add the
appropriate MODBUS starting address (as required). The following tables show the exact
range used for each group of data.
NOTE: For an automated MODBUS/Koyo address conversion utility, download the file
modbus_conversion.xls from the www.automationdirect.com technical support
website.
DL05 Memory Type
QTY
(Dec.)
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
MODBUS
Address Range
+
Start of Range
MODBUS
Data Type
+ Data Type
Inputs (X)
256
X0
--
X377
2048
--
2303
Input
Special Relays (SP)
512
SP0
--
SP777
3072
--
3583
Input
Outputs (Y)
256
Y0
--
Y377
2048
--
2303
Coil
Control Relays (C)
512
C0
--
C777
3072
--
3583
Coil
Timer Contacts (T)
128
T0
--
T177
6144
--
6271
Coil
Counter Contacts (CT)
128
CT0
--
CT177
6400
--
6527
Coil
Stage Status Bits (S)
256
S0
--
S377
5120
--
5375
Coil
For Word Data Types ....
128
V0
--
V177
Counter Current Values (V) 128
V1000
--
V--Memory, user data (V)
V1400
--
3072
+
Data Type
0
--
127
Input Register
V1177
512
--
639
Input Register
V7377
768
--
3839
Holding Register
MODBUS TCP
H0/H2--ECOM100
Timer Current Values (V)
Convert PLC Addr. to Dec.
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP/IP for H0/H2/H4--ECOM100
DL06 Memory Type
QTY
(Dec.)
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
MODBUS
Address Range
+
Start of Range
MODBUS
Data Type
+ Data Type
Inputs (X)
512
X0
--
X777
2048
--
2559
Input
Special Relays (SP)
512
SP0
--
SP777
3072
--
3583
Input
Outputs (Y)
512
Y0
--
Y777
2048
--
2559
Coil
Control Relays (C)
1024
C0
--
C1777
3072
--
4095
Coil
Timer Contacts (T)
256
T0
--
T377
6144
--
6399
Coil
Counter Contacts (CT)
128
CT0
--
CT177
6400
--
6527
Coil
Stage Status Bits (S)
1024
S0
--
S1777
5120
--
6143
Coil
Global Inputs (GX)
2048
GX0
--
GX3777
0
--
2047
Input
Global Outputs (GY)
2048
GY0
--
GY3777
0
--
2047
Coil
For Word Data Types ....
Timer Current Values (V)
Convert PLC Addr. to Dec.
+
256
V0
--
V377
Counter Current Values (V) 128
V1000
--
V1177
V--Memory, user data (V)
V400 -- V677
V1400 -- V7377
V10000 -- V17777
DL240 Memory Type
256
3072
4096
QTY
(Dec.)
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
Data Type
0
--
255
Input Register
512
--
639
Input Register
256
768
4096
----
511
3839
8191
Holding Register
MODBUS
Address Range
+
Start of Range
MODBUS
Data Type
+ Data Type
320
X0
--
X477
2048
--
2367
Input
Special Relays (SP)
144
SP0
SP540
---
SP137
SP617
3072
3280
---
3167
3471
Input
Outputs (Y)
320
Y0
--
Y477
2048
--
2367
Coil
Control Relays (C)
256
C0
--
C377
3072
--
3551
Coil
Timer Contacts (T)
128
T0
--
T177
6144
--
6271
Coil
Counter Contacts (CT)
128
CT0
--
CT177
6400
--
6527
Coil
Stage Status Bits (S)
512
S0
--
S777
5120
--
5631
Coil
Timer Current Values (V)
Convert PLC Addr. to Dec.
V0
--
V177
Counter Current Values (V) 128
V1000
--
V--Memory, user data (V)
1024
V2000
V--Memory, user data (V)
non--volatile
256
V--Memory, system (V)
106
Data Type
0
--
127
Input Register
V1177
512
--
639
Input Register
--
V3777
1024
--
2047
Holding Register
V4000
--
V4377
2048
--
2303
Holding Register
V7620
V7746
---
V7737
V7777
3984
4070
---
4063
4095
Holding Register
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP
H0/H2--ECOM100
128
+
Installation and
Inputs (X)
For Word Data Types ....
5--7
5--8
MODBUS TCP for H0/H2/H4--ECOM100
DL250--1 Memory Type
QTY
(Dec.)
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
+
Start of Range
MODBUS
Data Type
+ Data Type
Inputs (X)
512
X0
--
X777
2048
--
2560
Input
Special Relays (SP)
512
SP0
SP320
---
SP137
SP777
3072
3280
---
3167
3583
Input
Outputs (Y)
512
Y0
--
Y777
2048
--
2560
Coil
Control Relays (C)
1024
C0
--
C1777
3072
--
4095
Coil
Timer Contacts (T)
256
T0
--
T377
6144
--
6399
Coil
Counter Contacts (CT)
128
CT0
--
CT177
6400
--
6527
Coil
Stage Status Bits (S)
1024
S0
--
S1777
5120
--
6143
Coil
For Word Data Types ....
Timer Current Values (V)
Convert PLC Addr. to Dec.
256
V0
--
V377
Counter Current Values (V) 128
V1000
--
V1177
V--Memory, user data (V)
3072
4096
V1400 -V10000 --
V--Memory, system (V)
256
V7400
DL260 Memory Type
QTY
(Dec.)
--
Inputs (X)
1024
Special Relays (SP)
512
Outputs (Y)
+
Data Type
0
--
255
Input Register
512
--
639
Input Register
V7377
V17777
768
4096
---
3839
8191
Holding Register
V7777
3840
--
4095
Holding Register
MODBUS
Address Range
MODBUS
Data Type
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
+
Start of Range
+ Data Type
X0
--
X1777
2048
--
3071
Input
SP0
SP320
---
SP137
SP717
3072
3280
---
3167
3535
Input
1024
Y0
--
Y1777
2048
--
3071
Coil
Control Relays (C)
2048
C0
--
C3777
3072
--
5119
Coil
Timer Contacts (T)
256
T0
--
T377
6144
--
6399
Coil
Counter Contacts (CT)
256
CT0
--
CT377
6400
--
6655
Coil
Stage Status Bits (S)
1024
S0
--
S1777
5120
--
6143
Coil
Global Inputs (GX)
2048
GX0
--
GX3777
0
--
2047
Input
Global Outputs (GY)
2048
GY0
--
GY3777
0
--
2047
Coil
For Word Data Types ....
Timer Current Values (V)
MODBUS TCP
H0/H2--ECOM100
MODBUS
Address Range
Convert PLC Addr. to Dec.
256
V0
--
V377
Counter Current Values (V) 256
V1000
--
V1377
V--Memory, user data (V)
256
3072
11264
V400-- V777
V1400 -- V7377
V10000 -- V35777
V--Memory, system (V)
256
V7600 -V36000 --
V7777
V37777
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
+
Data Type
0
--
255
Input Register
512
--
767
Input Register
256
768
4096
----
511
3839
15359
Holding Register
3968
15360
---
4095
16383
Holding Register
MODBUS TCP/IP for H0/H2/H4--ECOM100
DL430 Memory Type
QTY
(Dec.)
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
MODBUS
Address Range
(Decimal)
+
Start of Range
MODBUS
Data Type
+ Data Type
Inputs (X)
320
X0
--
X477
2048
--
2367
Input
Special Relays (SP)
288
SP0
SP320
---
SP137
SP617
3072
3280
---
3167
3471
Input
Outputs (Y)
320
Y0
--
Y477
2048
--
2367
Coil
Control Relays (CR)
512
C0
--
C737
3072
--
3583
Coil
Timer Contacts (T)
128
T0
--
T177
6144
--
6271
Coil
Counter Contacts (CT)
128
CT0
--
CT177
6400
--
6527
Coil
Stage Status Bits (S)
384
S0
--
S577
5120
--
5503
Coil
Global I/O (GX)
512
GX0
--
GX777
0
--
511
Input
For Word Data Types ....
Timer Current Values (V)
Convert PLC Addr. to Dec.
128
V0
--
V177
Counter Current Values (V) 128
V1000
--
V--Memory, user data (V)
3072
V1400
V--Memory, system (V)
256
V7400
DL440 Memory Type
QTY
(Dec.)
+
Data Type
0
--
127
Input Register
V1177
512
--
639
Input Register
--
V7377
768
--
3839
Holding Register
--
V7777
3840
--
4095
Holding Register
MODBUS
Address Range
(Decimal)
MODBUS
Data Type
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
+
Start of Range
+ Data Type
320
X0
--
X477
2048
--
2367
Input
Special Relays (SP)
352
SP0
SP320
---
SP137
SP717
3072
3280
---
3167
3535
Input
Outputs (Y)
320
Y0
--
Y477
2048
--
2367
Coil
Control Relays (CR)
1024
C0
--
C1777
3072
--
4095
Coil
Timer Contacts (T)
256
T0
--
T377
6144
--
6399
Coil
Counter Contacts (CT)
128
CT0
--
CT177
6400
--
6527
Coil
Stage Status Bits (S)
1024
S0
--
S1777
5120
--
6143
Coil
Global I/O (GX)
1024
GX0
--
GX1777
0
--
1023
Input
256
V0
--
V377
Counter Current Values (V) 128
V1000
--
V--Memory, user data (V)
V--Memory, system (V)
+
Data Type
0
--
255
Input Register
V1177
512
--
639
Input Register
3072
4096
V1400 -- V7377
V10000 -- V17777
768
4096
---
3839
8191
Holding Register
288
V700 -- V737
V7400 -- V7777
448
3840
---
479
4095
Holding Register
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP
H0/H2--ECOM100
Timer Current Values (V)
Convert PLC Addr. to Dec.
Installation and
Inputs (X)
For Word Data Types ....
5--9
5--10
MODBUS TCP for H0/H2/H4--ECOM100
DL450 Memory Type
QTY
(Dec.)
PLC Range
(Octal)
For Discrete Data Types .... Convert PLC Addr. to Dec.
Inputs (X)
1024
Special Relays (SP)
512
Outputs (Y)
MODBUS
Address Range
(Decimal)
+
Start of Range
MODBUS
Data Type
+ Data Type
X0
--
X1777
2048
--
3071
Input
SP0
SP320
---
SP137
SP717
3072
3280
---
3167
3535
Input
1024
Y0
--
Y1777
2048
--
3071
Coil
Control Relays (CR)
2048
C0
--
C3777
3072
--
5119
Coil
Timer Contacts (T)
256
T0
--
T377
6144
--
6399
Coil
Counter Contacts (CT)
256
CT0
--
CT377
6400
--
6655
Coil
Stage Status Bits (S)
1024
S0
--
S1777
5120
--
6143
Coil
Global Inputs (GX)
1536
GX0
--
GX2777
0
--
1535
Input
Global Outputs (GY)
1536
GY0
--
GY2777
0
--
1535
Coil
For Word Data Types ....
256
V0
--
V377
Counter Current Values (V) 256
V1000
--
V--Memory, user data (V)
3072
12288
V--Memory, system (V)
320
+
Data Type
0
--
255
Input Register
V1377
512
--
767
Input Register
V1400 -V10000 --
V7377
V37777
768
4096
---
3839
16383
Holding Register
V700
V7400
V777
V7777
448
3840
---
768
4095
Holding Register
---
MODBUS TCP
H0/H2--ECOM100
Timer Current Values (V)
Convert PLC Addr. to Dec.
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP/IP for H0/H2/H4--ECOM100
5--11
The following examples show how to generate the MODBUS address and data type
for hosts which require this format.
Example 1: V2100
Find the MODBUS address for User V
location V2100.
1. Find V--Memory in the table.
2. Convert V2100 into decimal (1089).
3. Use the MODBUS data type from the table.
PLC Address (Dec.) + Data Type
V2100 = 1088 decimal
1088 + Hold. Reg. = Holding Reg. 1089
Example 2: Y20
Find the MODBUS address for output Y20.
PLC Addr. (Dec) + Start Addr. + Data Type
1. Find Y outputs in the table.
Y20 = 16 decimal
2. Convert Y20 into decimal (16).
16 + 2049 + Coil = Coil 2065
3. Add the starting address for the range
(2049).
4. Use the MODBUS data type from the table.
Example 3: T10
Current Value
Find the MODBUS address to obtain the
current value from Timer T10.
1. Find Timer Current Values in the table.
2. Convert T10 into decimal (8).
3. Use the MODBUS data type from the table.
Example 4: C54
Find the MODBUS address for Control Relay PLC Addr. (Dec) + Start Addr. +Data Type
C54.
C54 = 44 decimal
1. Find Control Relays in the table.
44 + 3072 + Coil = Coil 3117
2. Convert C54 into decimal (44).
3. Add the starting address for the range
(3072).
4. Use the MODBUS data type from the table.
PLC Address (Dec.) + Data Type
TA10 = 8 decimal
8 + Input Reg. = Input Reg. 8
Installation and
MODBUS TCP
H0/H2--ECOM100
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
5--12
MODBUS TCP for H0/H2/H4--ECOM100
If the Host Software Some MODBUS TCP clients do not allow you to specify the MODBUS data type and address.
or Client Requires an Instead, you specify an address only. This method requires another step to determine the
address, but it is not difficult. Basically, MODBUS also separates the data types by address
Address ONLY
ranges as well. This means an address alone can actually describe the type of data and
location. This is often referred to as “adding the offset”.
The actual equation used to calculate the address depends on the type of PLC data you are
using. The PLC memory types are split into two categories for this purpose.
• Discrete -- X, GX, SP, Y, CR, S, T, C (contacts)
• Word -- V--Memory , Timer current value, Counter current value
In either case, you basically convert the PLC octal address to decimal and add the
appropriate MODBUS starting address (as required). The following tables show the exact
range used for each group of data.
NOTE: For an automated MODBUS/Koyo address conversion utility, download the file
modbus_conversion.xls from the www.automationdirect.com website.
Discrete Data Types*
PLC Memory Type
Global Inputs (GX)
QTY (Dec.)
2048
PLC Range
(Octal)
GX0--GX1746
MODBUS Address
Access
Range
10001--10999
GX1747 -- GX3777
11000--12048
Inputs (X)
1024
X0 -- X1777
12049 -- 13072
Special Relays (SP)
512
SP0-- SP777
13073 -- 13584
--
--
13585 -- 20000
Global Outputs (GY)
2048
GY0-- GY3777
1 -- 2048
Outputs (Y)
1024
Y0 -- Y1777
2049 -- 3072
Control Relays (CR)
2048
C0 -- C3777
3073 -- 5120
Timer Contacts (T)
256
T0 -- T377
6145 -- 6400
Counter Contacts (CT)
256
CT0 -- CT377
6401 -- 6656
Stage Status Bits (S)
1024
S0 -- S1777
5121 -- 6144
--
--
6657 -- 10000
Reserved
Reserved
MODBUS TCP
H0/H2--ECOM100
* Refer to your PLC user manual for the correct memory mapping size of your PLC.
Some of the addresses shown above might not pertain to your particular CPU.
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
Read
only
Read/
Write
MODBUS TCP/IP for H0/H2/H4--ECOM100
5--13
Word Data Types*
Registers
(Word)
QTY (Dec.)
PLC Range
(Octal)
MODBUS 40001
Address Range
MODBUS 30001
Address Range
V--Memory (Timers)
256
V0 -- V377
40001 -- 40256
30001 -- 30256
V--Memory (Counters)
256
V1000 -- V1377
40513 -- 40768
30513 -- 30768
V--Memory (Data
Words)
256
V400 -- V777
40257 -- 40512
30257 -- 30512
3072
V1400 -- 7377
40769 -- 43840
30769 -- 33840
5903
V10000 -- V23416
44097 -- 49999
34097 -- 39999
5361
V23417 -- V35777
410000 -- 415360
310000 -- 315360
128
V7600 -- V7777
43969 -- 44096
33969 -- 34096
1024
V36000 -- V37777
415361 -- 416384
315361 -- 316384
V--Memory
(Remote Inputs)
128
V40000 -- V40177
416385 -- 416512
316385 -- 316512
Read
only
V--Memory
(Remote Outputs)
128
V40200 -- V40377
416513 -- 416640
316513 -- 316640
Read/
Write
V--Memory
(Input Points)
64
V40400 -- V40477
416641 -- 416704
316641 -- 316704
Read
only
V--Memory
(Output Points)
64
V40500 -- V40577
416705 -- 416768
316705 -- 316768
Read/
Write
V--Memory
(Control Relays)
128
V40600 -- V40777
416769 -- 416896
316769 -- 316896
V--Memory
(Timers Status Bits)
16
V41100 -- V41117
416961 -- 416976
316961 -- 316976
V--Memory
(Counter Status Bits)
16
V41140 -- V41157
416993 -- 417008
316993 -- 317008
V--Memory
(Special Relays)
32
V41200 -- V41237
417025 -- 417056
317025 -- 317056
V--Memory
(System Parameters)
Access
Read/
Write
Read
only
Installation and
* Refer to your PLC user manual for the correct memory mapping size of your PLC.
Some of the addresses shown above might not pertain to your particular CPU.
MODBUS TCP
H0/H2--ECOM100
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
5--14
MODBUS TCP for H0/H2/H4--ECOM100
Example 1: V2100
Find the MODBUS address for User V
location V2100.
1. Find V--Memory in the table.
2. Convert V2100 into decimal (1088).
3. Add the MODBUS starting address for the
mode (40001).
PLC Address (Dec.) + Mode Address
V2100 = 1088 decimal
1088 + 40001 = 41089
Find the MODBUS address for output Y20.
PLC Addr. (Dec) + Start Address + Mode
1. Find Y outputs in the table.
Y20 = 16 decimal
2. Convert Y20 into decimal (16).
16 + 2048 + 1 = 2065
3. Add the starting address for the range
(2048).
4. Add the MODBUS address for the mode
(1).
Example 3: C54
Find the MODBUS address for Control Relay PLC Addr. (Dec) + Start Address + Mode
C54.
C54 = 44 decimal
1. Find Control Relays in the table.
44 + 3072 + 1 = 3117
2. Convert C54 into decimal (44).
3. Add the starting address for the range
(3072).
4. Add the MODBUS address for the mode
(1).
MODBUS TCP
H0/H2--ECOM100
Example 2: Y20
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP/IP for H0/H2/H4--ECOM100
5--15
Network Client (master) Operation
This section describes how the DL05/06/205/405 CPU can serve as a client on a
MODBUS TCP network using the H0/H2/H4--ECOM100. This section discusses how to
design the required ladder logic for network client operation.
Client
MODBUS TCP Servers
Slave #1
Slave #2
Slave #3
MODBUS TCP Protocol
When using the ECOM100 as a client on the
network, you use simple RLL instructions to
initiate the requests. The WX instruction
initiates network write operations, and the RX
instruction initiates network read operations.
Before executing either the WX or RX
commands, we need to load data related to
the read or write operation onto the CPU’s
accumulator stack. When the WX or RX
instruction executes, it uses the information
on the stack combined with data in the
instruction box to completely define the task.
Client
Slave
WX (write)
RX (read)
Network
MODBUS
Function Code
Function
DL05/06/205/405
Data Types Available
Read Output Table
Y, C, T, CT
02
Read Input Table
X, SP
03
Read Holding Registers (when addressing
mode is 584/984, this function is used to access analog output registers)
V
15
Force Multiple Outputs
Y, C, T, CT
16
Preset Multiple Registers
V
NOTE: The H0/H2/H4--ECOM100, as a client/master, does not support function
code 4. Thus, 30001 address ranges cannot be read from a server/slave device.
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP
H0/H2--ECOM100
01
Installation and
MODBUS Function The H0/H2/H4--ECOM100 supports the following MODBUS function codes when
Codes Supported acting as a MODBUS TCP client.
5--16
MODBUS TCP for H0/H2/H4--ECOM100
PLC Memory
Supported for
Client Operation
The actual equation used to calculate the address depends on the type of PLC data you are
using. The PLC memory types are split into three categories for this purpose.
• Discrete -- X, GX, SP
• Discrete -- Y, CR, S, T, C
• Word -- Timer current value, Counter current value, Data Words
In either case, you basically take the MODBUS address you are trying to target, subtract the
starting MODBUS of that range, convert the result to octal and add the octal number to the
begining PLC address in the appropriate PLC range. See the conversion examples on the
following page. The following tables show the exact range used for each group of data.
NOTE: For an automated MODBUS/Koyo address conversion utility, download the file
modbus_conversion.xls from the www.automationdirect.com website.
Discrete Data Types*
PLC Memory Type
Global Inputs (GX)
PLC Range
(Octal)
QTY (Dec.)
2048
GX0--GX1746
MODBUS Address
Access
Range
10001--10999
GX1747 -- GX3777
11000--12048
Inputs (X)
1024
X0 -- X1777
12049 -- 13072
Special Relays (SP)
512
SP0-- SP777
13073 -- 13584
--
--
13585 -- 20000
Global Outputs (GY)
2048
GY0-- GY3777
1 -- 2048
Outputs (Y)
1024
Y0 -- Y1777
2049 -- 3072
Control Relays (CR)
2048
C0 -- C3777
3073 -- 5120
Timer Contacts (T)
256
T0 -- T377
6145 -- 6400
Counter Contacts (CT)
256
CT0 -- CT377
6401 -- 6656
Stage Status Bits (S)
1024
S0 -- S1777
5121 -- 6144
--
--
6657 -- 10000
Reserved
Reserved
Read
only
Read/
Write
Word Data Types*
MODBUS TCP
H0/H2--ECOM100
Registers
(Word)
PLC Range
(Octal)
QTY (Dec.)
MODBUS Address
Access
Range
V--Memory (Timers)
256
V0 -- V377
40001 -- 40256
V--Memory (Counters)
256
V1000 -- V1377
40513 -- 40768
V--Memory (Data Words)
256
V400 -- V777
40257 -- 40512
3072
V1400 -- 7377
40769 -- 43840
5903
V10000 -- V23416
44097 -- 49999
5361
V23417 -- V35777
410000 -- 415360
128
V7600 -- V7777
43969 -- 44096
1024
V36000 -- V37777
415361 -- 416384
V--Memory
(System Parameters)
Read/
Write
* Refer to your PLC user manual for the correct memory mapping size of your PLC.
Some of the addresses shown above might not pertain to your particular CPU.
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP/IP for H0/H2/H4--ECOM100
5--17
NOTE: Your PC’s Windows calculator can be used for number conversions (i.e. decimal to
octal). The Windows calculator must be in Calculator>View>Scientific mode to enable number
conversions capability.
Example 1:
Calculating Word
PLC Address
Example 2:
Calculating Discrete
Input PLC Address
Find the PLC address to use to target MODBUS
address 41025 in a server device.
1. Subtract the begining of the MODBUS word
address range (40001) from the desired
MODBUS address to target.
2. Convert decimal result into octal.
3. Add octal result to begining PLC range
(Input, Output or Word).
Find the PLC address to use to target MODBUS
address 12060 in a server device.
1. Subtract the begining of the MODBUS Input
address range (12049) from the desired
MODBUS address to target.
2. Convert decimal result into octal.
3. Add octal result to begining PLC range
(Input, Output or Word).
1. 41025 -- 40001 = 1024 decimal
2. 1024 decimal = 2000 octal
3. V0 (octal) + 2000 (octal) = V2000 octal
1. 12060 -- 12049 = 11 decimal
2. 11 decimal = 13 octal
3 X0 (octal) + 13 (octal) = X13 octal
Installation and
MODBUS TCP
H0/H2--ECOM100
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
5--18
MODBUS TCP for H0/H2/H4--ECOM100
Building the
Read (RX) or
Write (WX)
Routine
For network communications, you build the
Read (RX) or Write (WX) instructions into a
routine which requires the four instructions
you see to the right. They must be used in the
sequence shown. The following step-by-step
procedure will provide you the information
necessary to set up your ladder program to
receive data from a network server.
LD
A aaa
LD
A aaa
LDA
O aaa
RX or WX
A aaa
Step 1:
Identify ECOM Slot
Location and
Server Node #
The first Load (LD) instruction accepts either a constant or a variable.
Use a “K” to designate the number as a constant. Use a “V” if you are
entering the address of a register. The contents of that register perform
the same function as the constant shown below. For example, you could
use V2000 in place of K0114. If the contents of V2000 is the number
“114,” the function would be the same. Using a variable allows changing
parameters while the program is running.
Upper Byte
Lower Byte
Initiating PLC/ECOM
(Client)
Initiating PLC
See page 2-7 and 2-8 about
slot numbers.
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
K114
Responding
device (Server)
ECOM Slot Number
MODBUS TCP
H0/H2--ECOM100
Base Number
CPU Base = 0
Expansion Base = 1, 2 or 3
See page 2-7 and 2--9 about using ECOMs in local expansion or
in remote I/O bases.
K 0 1 1 4
LD
Server Node #
Responding Device on Network
See page 3--10 or 6--4 about
assigning a node number to a
server’s IP address
5--19
MODBUS TCP/IP for H0/H2/H4--ECOM100
Step 2:
Load Number of
Bytes to Transfer
Step 3:
Specify Master
Memory Area
The second Load (LD) instruction
determines the number of bytes which will
be transferred between the master and
slave in the subsequent WX or RX
instruction. The value to be loaded is in
BCD format (decimal), from 1 to 128
bytes.
The third instruction in the RX or WX
sequence is a Load Address (LDA)
instruction. Its purpose is to load the
starting address of the memory area to be
transferred. Entered as an octal number,
the LDA instruction converts it to hex and
places the result in the accumulator.
For a WX instruction, the CPU sends the
number of bytes previously specified from
its memory area beginning at the LDA
address specified.
For an RX instruction, the CPU reads the
number of bytes previously specified from
the server, placing the received data into
its memory area beginning at the LDA
address specified.
1
2
8
(BCD)
# of bytes to transfer
LD
K128
4
0
6
0
0
(octal)
Starting address of
client transfer area
LDA
O40600
MSB
V40600
LSB
15
0
MSB
V40601
LSB
15
0
Step 4:
Specify Slave
Memory Area
The last instruction in our sequence is the
WX or RX instruction itself. Use WX to
write to the server, and RX to read from the
server. All four of our instructions are
shown to the right. In the last instruction,
you must specify the starting address and
a valid data type for the server.
SP122
LD
K114
LD
K128
Installation and
NOTE: Since V--memory words are always 16 bits, you may not always use the
whole word. For example, if you only specify to read 3 bytes, you will only get 24 bits
of data. In this case, only the 8 least significant bits of the last word location will be
modified. The remaining 8 bits are not affected.
LDA
O40600
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP
H0/H2--ECOM100
RX
V0
5--20
MODBUS TCP for H0/H2/H4--ECOM100
Communications
from a
Ladder Program
Typically network communications will
last longer than 1 scan. The program must
wait for the communications to finish
before starting the next transaction.
SP123
Y1
SET
SP122
LD
K114
ECOM Communication
Error
LD
K3
ECOM Port Busy
LDA
O40600
RX
V0
Depending on which slot the ECOM is in, it has two Special Relay contacts
associated with it (see page 4--11 to 4--12 for special relays). One indicates “Port
busy”, and the other indicates “Port Communication Error”. The example above
shows the use of these contacts for an ECOM that is in slot 1. The “Port Busy” bit is
on while the PLC communicates with the slave. When the bit is off the program can
initiate the next network request.
The “Port Communication Error” bit turns on when the PLC has detected an error.
Use of this bit is optional. When used, it should be ahead of any network instruction
boxes since the error bit is reset when an RX or WX instruction is executed.
If you are using multiple reads and writes
in the RLL program, you have to interlock
the routines to make sure all the routines
are executed. If you don’t use the
interlocks, then the CPU will only execute
the first routine. This is because each port
can only handle one transaction at a time.
In the example to the right, after the RX
instruction is executed, C0 is set. When
the port has finished the communication
task, the second routine is executed and
C0 is reset.
If you’re using RLL PLUS Stage
Programing, you can put each routine in a
separate program stage to ensure proper
execution and switch from stage to stage
allowing only one of them to be active at a
time.
MODBUS TCP
H0/H2--ECOM100
Multiple Read and
Write Interlocks
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
Interlocking Relay
SP122 C100
LD
K114
LD
K3
LDA
O40600
Interlocking
Relay
SP122 C100
RX
V0
C100
SET
LD
K114
LD
K3
LDA
O40400
WX
V0
C100
RST
5--21
MODBUS TCP/IP for H0/H2/H4--ECOM100
H0/H2/H4--ECOM100 System Memory
H0/H2/H4--ECOM100
Module Version
Information
Device Data
Words
(16--bit)
Word Descriptions
Access
317501 -- 317506;
(417501 -- 417506)*
6
1
2
3
4
5
6
Read
only
317507 -- 317510
(417507 -- 417510)
--
Reserved
--
317511 -- 317600;
(417511 -- 417600)*
90
1 -- Version of Device
2 -- Family
3 -- Processor
4 -- Module Type
5 -- Status Code
(6--8) -- Ethernet Address
9 -- RAM Size
10 -- Flash Size
11 -- Batt RAM Size
12 -- DIP Settings
13 -- Media Type
(14--15) -- EPF Count (if supported)
16 -- Run Relay State (if supported)
17 -- Batt Low (if supported)
18 -- Model Number
19 -- Ethernet Speed
(20--90) -- Reserved
Read
only
317601 -- 318500
(417601 -- 418500)
--
Reserved
--
418001 -- 418020
20
(1--3) -- Reserved
Read/
4 -- Flags:
Write
Bit 0: If 1, module has rebooted
since this bit was cleared, a write to
the Flags word with this bit set will
clear this reboot bit.
Bit (1--7) -- Reserved
5 -- Reboot Count (LSW) -- Read Only
6 -- Reboot Count (MSW) -- Read Only
(7--20) -- Reserved
418021 -- 419250
--
Reserved
-------
OS Major Version
OS Minor Version
OS Build Version
Booter Major Version
Booter Minor Version
Booter Build Version
Installation and
Dynamic
Module Data
Modbus Addressing
Range (Decimal)
--
Ethernet Communications Modules, 3rd Edition Rev C, 06/11
MODBUS TCP
H0/H2--ECOM100
*For clients that only support function code 3 to read word data.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement