beautypg.com

2 function codes, Function codes, Modbus tcp kommunikation – Lenze I/O system 1000 System Manual User Manual

Page 719

background image

Modbus TCP Kommunikation

Access to the I/O system 1000

Function codes

13

l

719

EDSIO1000 EN 7.0

13.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:

Code Command

Description

01

h

Read n bits

Read n bits from the master output range 0x

02

h

Read n bits

Read n bits from the master input range 1x

03

h

Read n words

Read n words from the master output range 4x

04

h

Read n words

Read n words from the master input range 3x

05

h

Write 1 bit

Write 1 bit in the master output range 0x

06

h

Write 1 word

Write 1 word in the master output range 4x

0F

h

Write n bits

Write n bits in the master output range 0x

10

h

Write n words

Write n words in the master output range 4x

16

h

Mask 1 word

Mask 1 word in the master output range 4x

17

h

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

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 80

h

. If

no error has occurred, the function code is returned.

Coupler response:

Function code OR 80

h

® 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:

01

h

: Function number is not supported

02

h

: Faulty addressing

03

h

: Faulty data

04

h

: System SLIO bus is not initialised

07

h

: General error

Read n bits

Code 01

h

: Read n bits of master output range 0x.

Code 02

h

: Read n bits of master input range 1x.

Command frame:

Modbus TCP header

Slave address

Function

code

Address

1. bit

Number

Bits

x

x

0

0

0

6

6 bytes

1 byte

1 byte

1 word

1 word

Response message:

Modbus TCP header

Slave address

Function

code

Number of

read bytes

Data

1. byte

Data

2. byte

...

x

x

0

0

0

6 bytes

1 byte

1 byte

1 byte

1 byte

1 byte

max. 252 bytes