10 Modbus TCP communication
10.2 Access to the I/O system 1000
575
Lenze · I/O system 1000 · Reference Manual · DMS 5.0 EN · 09/2016 · TD17
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
10.2.2 Function codes
The following function codes can be used to access a slave by a Modbus master. The description is
always made from the master's view:
The following always applies to the byte order in the word: HIGH byte | LOW byte
Response of the bus coupler
If the slave returns an error, the function code is returned in an OR-ed manner with 0x80. If no error
has occurred, the function code is returned.
Coupler response:
Function code OR 0x80 error & error number
Function code OK
In the event of an error you will receive additionally an error number in another byte. Here, the
following error numbers exist:
0x01: Function number is not supported
0x02: Faulty addressing
0x03: Faulty data
0x04: System SLIO bus is not initialised
0x07: General error
Read n bits
Code 0x01: Read n bits of master output range 0x.
Code 0x02: Read n bits of master input range 1x.
Command frame:
Response message:
Code Command Description
0x01 Read n bits Read n bits from the master output range 0x
0x02 Read n bits Read n bits from the master input range 1x
0x03 Read n words Read n words from the master output range 4x
0x04 Read n words Read n words from the master input range 3x
0x05 Write 1 bit Write 1 bit in the master output range 0x
0x06 Write 1 word Write 1 word in the master output range 4x
0x0F Write n bits Write n bits in the master output range 0x
0x10 Write n words Write n words in the master output range 4x
0x16 Mask 1 word Mask 1 word in the master output range 4x
0x17 Write n words and read m words Write n words in the master output range 4x and the
response contains m read words of the master input
range 3x
Modbus TCP Header Slave
Address
Function
code
Address
1. bit
Number
Bits
x x 0 0 0 6
6 byte 1 byte 1 byte 1 word 1 word
Modbus TCP Header Slave
Address
Function
code
Number of
read bytes
Data
1st byte
Data
2nd byte
...
x x 0 0 0
6 byte 1 byte 1 byte 1 byte 1 byte 1 byte
max. 252 bytes