Chapter 9. Modbus/TCP Client
148
PACSystems* RX7i & RX3i TCP/IP Ethernet Communications User Manual
GFK-2224Q
Read Data from a Modbus/TCP Device (3003)
The Read Data from a Modbus/TCP Device COMMREQ requests a data transfer from a Modbus/TCP device to
the PLC. The Read Data COMMREQ must reference an active Modbus/TCP channel previously established with
the Open Modbus/TCP Client Connection COMMREQ.
Registers, Coils or Exception Status data may be read from the remote Modbus/TCP device. The Modbus
Function Code specifies the data type. Valid Function Codes for the Read Data COMMREQ are presented in the
following table
.
Function
Code
Description
Modbus Server Memory
Region Accessed
Data Unit Size Maximum Data Units
1
Read Coils
Internal Bits or Physical coils Bit
2000
2
Read Input Discretes
Physical Discrete Inputs
Bit
2000
3
Read Multiple
Registers
Internal Registers or Physical
Output Registers
Register
(16-bit Word)
125
4
Read Input Registers
Physical Input Registers
Register
(16-bit Word)
125
7
Read Exception Status Server Exception Memory
Byte
Not Applicable
24
Read FIFO Queue
Internal Registers or Physical
Output Registers
Register
(16-bit Word)
32
The table above describes the general Modbus server memory areas. The actual memory accessed is
dependent on how the server maps the Modbus memory regions to the server’s local memory.
An Address and Length specify the location of the data in the remote device and the number of data units to
transfer. The Length is the number of Registers or Coils to transfer. Modbus Function Code 7, Read Exception
Status does not require the address as the remote device retrieves the exception status from an internal
location.
When transferring data between server bit or coil memory to PLC bit memory, only the number of bits specified
is transferred. For example, if the COMMREQ requests to read 9 coils from the Remote Device and requests to
put the data at %M00001 in the Local PLC (using a bit type memory type), %M00001 through %M00009 will be
updated with the data from the Remote Device and %M00010 through %M00016 will be unaffected. However,
if server bit or coil memory is transferred to PLC byte or word memory, the following rules apply:
1.
Transferring discrete data from the Remote Device to Local PLC Word (16-bit) memory: If the number of
requested coils is not a multiple of 16, the data is padded with 0s to a 16-bit boundary. For example if the
COMMREQ requests reading 17 coils from the Remote Device and requests to place this data at %R00010,
%R00010 (all 16 bits) and bit 0 of %R00011 will be updated with values from the Remote Device and bits 1
through 15 of %R00011 will be set to 0.
2.
Transferring discrete data from the Remote Device to Local PLC byte memory (using byte type memory
type): If the number of requested coils is not on an 8-bit boundary, the data is padded with 0s to an 8-bit
boundary. For example if the COMMREQ requests 9 coils from the Remote Device and requests to place
this data at %M00001, %M00001 through %M00009 will be updated with values from the Remote Device
and %M00010 through %M00016 will be set to 0.
Data returned from the remote device is stored in the PLC data area specified in the Read Modbus/TCP Device
COMMREQ. Data can be stored in any of the PLC data areas. Refer to
on page 150 for
the list of data areas and identification codes for the PLC. Note that the first item referred to in each data area
is item 1 (not item 0).
The COMMREQ Status Word (CRS) indicates the success or failure of the Read Data COMMREQ. If the COMMREQ
requests an invalid channel number or any other field is invalid the COMMREQ fails and the CRS is set to a non-
Содержание PACSystems RX7i
Страница 45: ......
Страница 54: ...Chapter 4 Configuration GFK 2224Q January 2017 41 Figure 18 CPE400 Advanced Ethernet Configuration LAN1 LAN 2 ...
Страница 80: ...Chapter 4 Configuration GFK 2224Q January 2017 67 ...
Страница 81: ......
Страница 122: ...Chapter 6 Programming EGD Commands GFK 2224Q January 2017 109 ...
Страница 142: ...Chapter 7 Programming SRTP Channel Commands GFK 2224Q January 2017 129 Figure 51 Sample Ladder Logic for COMMREQ ...
Страница 147: ......
Страница 193: ...Chapter 10 OPC UA Server 180 PACSystems RX7i RX3i TCP IP Ethernet Communications User Manual GFK 2224Q Example ...
Страница 202: ...Chapter 10 OPC UA Server GFK 2224Q January 2017 189 Figure 73 Machine Edition Online Command to Set Passwords ...
Страница 211: ......
Страница 253: ...Chapter 12 Diagnostics 240 PACSystems RX7i RX3i TCP IP Ethernet Communications User Manual GFK 2224Q ...
Страница 262: ...Chapter 13 Network Administration GFK 2224Q January 2017 249 ...
Страница 263: ......