Technical data

158 MODBUS Functions
Description of the MODBUS Functions
WAGO-I/O-SYSTEM 750
ETHERNET TCP/IP
6.3.11 Function Code FC23 (Read/Write multiple registers)
This function performs a combination of a read and write operation in a single
request. The function can write the new data to a group registers, and then
return the data of a different group.
Request
The reference numbers (addresses) are zero-based in the request message;
therefore, the first register is at address 0.
The request message specifies the registers to read and write. The data is sent
as 2 bytes per register.
Example: The data in register 3 is set to value 0x0123, and values 0x0004 and
0x5678 are read out of the two registers 0 and 1.
Byte Field name Example
Byte 0, 1 Transaction identifier 0x0000
Byte 2, 3 protocol identifier 0x0000
Byte 4, 5 length field 0x000F
Byte 6 Unit identifier 0x01 not used
Byte 7 MODBUS function code 0x17
Byte 8-9 reference number for read 0x0000
Byte 10-11 Word count for read (1-125) 0x0002
Byte 12-13 reference number for write 0x0003
Byte 14-15 Word count for write (1-100) 0x0001
Byte 16 Byte Count
(B = 2 x word count for write)
0x02
Byte
17-(B+16)
Register Values 0x0123
Response
Byte Feldname Beispiel
....
Byte 7 MODBUS function code 0x17
Byte 8 Byte Count
(B = 2 x word count for read)
0x04
Byte 9-
(B+1)
Register Values 0x0004
0x5678
Exception
Byte Field name Example
.....
Byte 7 MODBUS function code 0x97
Byte 8 Exception code 0x01 or 0x02
Note
If register areas for read and write overlap, the results are undefined.