Deployment
Wieland Electric GmbH | BA001269 | 09/2021 (Rev. A)
52
Overview
With the following Modbus function codes a Modbus master can access a Modbus slave. The descrip-
tion always takes place from the point of view of the master:
Code
Command
Description
01h
Read n Bits
Read n bits of master output area 0x
02h
Read n Bits
Read n bits of master input area 1x
03h
Read n Words
Read n words of master output area 4x
04h
Read n Words
Read n words master input area 3x
05h
Write 1 Bit
Write 1 bit to master output area 0x
06h
Write 1 Word
Write 1 word to master output area 4x
0Fh
Write n Bits
Write n bits to master area 0x
10h
Write n Words
Write n words to master area 4x
16h
Mask 1 Word
Mask 1 word in master output area 4x
17h
Write n words and read m words
Write n words into master output area 4x and the re-
spond contains m read words of the master input area
3x
Byte sequence in a word
1 word
High byte
Low byte
Respond of the coupler
If the slave announces an error, the function code is sent back with a 'OR' and 80h. Without an error,
the function code is sent back.
Coupler answer
Function code OR 80h
Error & error number
Function code
OK
If the slave announces an error, the function code is sent back with a 'OR' and 80h. Without an error,
the function code is sent back.
01h: Function number is not supported
02h: Addressing errors
03h: Data errors
04h:
ricos
FLEX bus is not initialized
07h: General error
Read n Bits 01h, 02h
Code 01h: Read n bits of master output area 0x.
Code 02h: Read n bits of master input area 1x.
Command telegram
Modbus/TCP-Header Slave address
Function code
Address 1. bit
Number of bits
x x 0 0 0 6
6 byte
1 byte
1 byte
1 word
1 word
Respond telegram
Modbus/TCP-Header Slave
address
Function
code
Number of
read bytes
Data
1. byte
Data
2. byte
…
x x 0 0 0
6 byte
1 byte
1 byte
1 byte
1 byte
1 byte
max. 252 byte