62
Manual – MOVI-PLC® advanced DHR41B for EtherNet/IP, Modbus/TCP and PROFINET IO
7
Examples for data exchange via Modbus/TCP
Configuration and Startup (Modbus/TCP)
7.5.1 Writing and reading process data
The process data exchange can be performed either via FC3 (read) and FC16 (write),
or FC23 (read and write):
For writing 3 process data words (setpoints) to a Modbus/TCP slave via FC16, the
TCP/IP telegram to port 502 is structured as illustrated above.
Only bytes 0-11 are returned in the response telegram of port 502 of the Modbus/TCP
slave, where all values remain unchanged with the exception of byte 5. Byte 5 (low byte
length field) is corrected to value 6.
Byte Value Meaning Interpretation Help
0
0x00 Transaction identifier
For a detailed description,
refer to Modbus/TCP specifi-
cation and section 'Modbus
protocol (Modbus/TCP)'
1
2
0x00 Protocol identifier
3
40x00
Length field
Number of bytes after byte 5:
3 (no. of PD) × 2 + 7 = 13
50x0d
6 0xFF Unit identifier Must be 0 or 255
7 ox10 Function code Service = FC16 (write register)
80x00
Write reference number
Offset from where on the PD is
located:
Must always be 4
90x04
10 0x00
Write word count
Number of PDW (here 3):
Must for PD 1 64
11 0x03
12 0x06 Write byte count Number of PDW × 2 = 6
13 0x00
Data
Process output data word 1
Data mapping and definition,
see IEC program
14 0x11
15 0x22
Process output data word 2
16 0x33
17 0x44
Process output data word 3
18 0x55