Chapter 9. Modbus/TCP Client
154
PACSystems* RX7i & RX3i TCP/IP Ethernet Communications User Manual
GFK-2224Q
Write Data to a Modbus/TCP Device (3004)
The Write Data to a Modbus/TCP Device COMMREQ requests a data transfer from the PLC to a Modbus/TCP
server. The Write Data COMMREQ must reference an active Modbus/TCP channel previously established with
the Open Modbus/TCP Client Connection COMMREQ.
Registers or Coils may be written to the remote Modbus/TCP device. The Modbus Function Code specifies the
data type. Valid Function Codes for the Write Data COMMREQ are presented in the following table:
Function
Code
Description
Modbus Server Memory Region Accessed Data Unit
Size
Maximum
Data Units
5
Write Single Coil
Internal Bits or Physical coils
Bit
1
6
Write Single Register
Internal Registers or Physical Output
Registers
Register
1
15
Write Multiple Coils
Internal Bits or Physical coils
Bit
1968
16
Write Multiple
Registers
Internal Registers or Physical Output
Registers
Register
123
An Address Offset and Length specify the location in the Modbus/TCP device and the number of data units to
transfer. The Address Offset is the offset from the Base Address for that memory region in the server. The
Length is the number of Registers or Coils to transfer.
A PLC data area is the source for the data written to the Modbus/TCP device. The source of data can be any of
on page 150).
Function Code 5,
Write Single Coil, forces a Coil On or Off. To force a coil off, the value zero (0) is used as the
COMMREQ data value. If the PLC memory type is a bit type, the remote device coil is set to the same state as
the specified PLC memory location. If the PLC memory type is a byte or word type, a value of zero (0) is used to
force a coil off and a value of one (1) is used to force a coil on.
Function Code 15,
Write Multiple Coils, forces multiple Coils On or Off. If the PLC memory type is a bit type,
remote device coils are set to the same state as the corresponding bits in the specified PLC memory location. If
the PLC memory type is byte or word type, the remote device coils follow the state of the packed bits contained
in the byte or word memory. For example, if 16 coils are written to a PACSystems Modbus server starting at
%Q1 from the client PLC memory at %R1 containing a value of 0x1111, the following remote server coils will be
set %Q1, %Q5, %Q9 and %Q13 and the following remote server bits will be cleared: %Q2, %Q3, %Q4, %Q6,
%Q7, %Q8, %Q10, %Q11, %Q12, %Q14, %Q15, %Q16.
The COMMREQ Status Word (CRS) indicates the success or failure of the Write Data COMMREQ. If the COMMREQ
specifies an invalid channel number or any other invalid field the COMMREQ fails and the CRS is set to a non-
zero value to identify the failure. See the section “Status Data” later in this document for detailed CRS failure
codes.
Содержание 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: ......